mirror of
https://github.com/pezkuwichain/pezkuwi-dev.git
synced 2026-04-25 01:07:55 +00:00
fix: update header pattern to allow 'authors & contributors' suffix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# @pezkuwi/dev-ts
|
||||
|
||||
This is an Node TS loader, specifically written to cater for the polkadot-js needs, aka it is meant to be used inside polkadot-js projects. It doesn't aim to be a catch-all resolver, although it does cover quite a large spectrum of functionality.
|
||||
This is an Node TS loader, specifically written to cater for the pezkuwi-js needs, aka it is meant to be used inside pezkuwi-js projects. It doesn't aim to be a catch-all resolver, although it does cover quite a large spectrum of functionality.
|
||||
|
||||
It caters for -
|
||||
|
||||
@@ -18,7 +18,7 @@ Just add the loader via the Node.js `--loader` option. The API supported here is
|
||||
node --loader @pezkuwi/dev-ts ...
|
||||
```
|
||||
|
||||
Internally to the polkadot-js libraries, loader caching is used. This means that compiled files are store on-disk alongside the `/src/` folder in `/build-loader/`. To enable caching behavior, the loader endpoint is changed slightly,
|
||||
Internally to the pezkuwi-js libraries, loader caching is used. This means that compiled files are store on-disk alongside the `/src/` folder in `/build-loader/`. To enable caching behavior, the loader endpoint is changed slightly,
|
||||
|
||||
```
|
||||
node --loader @pezkuwi/dev-ts/cached ...
|
||||
@@ -31,7 +31,7 @@ This is generally the suggested default, but it is only exposed via a different
|
||||
|
||||
The Node.js loader API could change in the future (as it has in the Node.js 16.12 version), so it _may_ break or stop working on newer versions, and obviously won't work at all on older versions. As of this writing (Node.js 18.14 being the most-recent LTS), using the `--loader` option will print a warning.
|
||||
|
||||
With all that said, it is used as-is for the polkadot-js test infrastructure and currently operates without issues in _that_ environment.
|
||||
With all that said, it is used as-is for the pezkuwi-js test infrastructure and currently operates without issues in _that_ environment.
|
||||
|
||||
TL;DR Different configs could yield some issues.
|
||||
|
||||
@@ -44,4 +44,4 @@ We started off with a basic `swc` loader (after swapping the infrastructure from
|
||||
|
||||
Since then we just swapped to using base `tsc` everywhere (for all builds) and may look at changing again (swc, esbuild. etc...) in the future. So effectively having a single loader, while re-inventing the wheel somewhat (since there seems to be a _lot_ of options available) allows us to just keep the loader compiling options fully aligned with what TS -> JS output approach we take.
|
||||
|
||||
It meets our requirements: aligns fully with the overall configs we accross polkadot-js, compiles to ESM (no CJS used when testing/running) and has minimal dependencies that doesn't add bloat. In most cases you would probably be better off with one of the loaders/registration approaches linked in the first paragraph.
|
||||
It meets our requirements: aligns fully with the overall configs we accross pezkuwi-js, compiles to ESM (no CJS used when testing/running) and has minimal dependencies that doesn't add bloat. In most cases you would probably be better off with one of the loaders/registration approaches linked in the first paragraph.
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/pezkuwi/dev/issues",
|
||||
"bugs": "https://github.com/pezkuwichain/pezkuwi-dev/issues",
|
||||
"description": "An TS -> ESM loader for Node >= 16.12",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"homepage": "https://github.com/pezkuwi/dev/tree/master/packages/dev-ts#readme",
|
||||
"homepage": "https://github.com/pezkuwichain/pezkuwi-dev/tree/master/packages/dev-ts#readme",
|
||||
"license": "Apache-2.0",
|
||||
"name": "@pezkuwi/dev-ts",
|
||||
"repository": {
|
||||
"directory": "packages/dev-ts",
|
||||
"type": "git",
|
||||
"url": "https://github.com/pezkuwi/dev.git"
|
||||
"url": "https://github.com/pezkuwichain/pezkuwi-dev.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"version": "0.84.3",
|
||||
"version": "0.85.0",
|
||||
"main": "./cjs/index.js",
|
||||
"exports": {
|
||||
"./cjs/package.json": "./cjs/package.json",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { loaderOptions } from './common.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { LoaderOptions } from './types.js';
|
||||
@@ -25,7 +25,7 @@ export const EXT_TS_REGEX = /\.tsx?$/;
|
||||
/** RegEx for matching JS files (imports map to TS) */
|
||||
export const EXT_JS_REGEX = /\.jsx?$/;
|
||||
|
||||
/** RegEx for json files (as actually aliassed in polkadot-js) */
|
||||
/** RegEx for json files (as actually aliassed in pezkuwi-js) */
|
||||
export const EXT_JSON_REGEX = /\.json$/;
|
||||
|
||||
/** Options for loader config */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Adapted from: https://nodejs.org/api/esm.html#esm_transpiler_loader
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import crypto from 'node:crypto';
|
||||
@@ -63,7 +63,7 @@ export async function load (url: string, context: Record<string, unknown>, nextL
|
||||
module: ts.ModuleKind.ESNext,
|
||||
moduleResolution: ts.ModuleResolutionKind.NodeNext,
|
||||
skipLibCheck: true,
|
||||
// Aligns with packages/dev/scripts/polkadot-dev-build-ts & packages/dev/config/tsconfig
|
||||
// Aligns with packages/dev/scripts/pezkuwi-dev-build-ts & packages/dev/config/tsconfig
|
||||
target: ts.ScriptTarget.ES2022
|
||||
},
|
||||
fileName: fileURLToPath(url)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
// Do not edit, auto-generated by @pezkuwi/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/dev-ts', path: 'auto', type: 'auto', version: '0.84.2' };
|
||||
export const packageInfo = { name: '@pezkuwi/dev-ts', path: 'auto', type: 'auto', version: '0.84.2' };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/// <reference types="@pezkuwi/dev-test/globals.d.ts" />
|
||||
@@ -124,7 +124,7 @@ describe('resolveExtBare', () => {
|
||||
describe('resolveAliases', () => {
|
||||
it('resolves packageInfo', () => {
|
||||
expect(
|
||||
resolveAlias('@polkadot/dev-ts/packageInfo', ROOT_URL)
|
||||
resolveAlias('@pezkuwi/dev-ts/packageInfo', ROOT_URL)
|
||||
).toEqual({
|
||||
format: 'module',
|
||||
shortCircuit: true,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import fs from 'node:fs';
|
||||
@@ -112,7 +112,7 @@ export function resolveExtJson (specifier: string, parentUrl: URL | string): Res
|
||||
*
|
||||
* At some point we probably might need to extend this to cater for the
|
||||
* ts (recommended) approach for using .js extensions inside the sources.
|
||||
* However, since we don't use this in the polkadot-js code, can kick this
|
||||
* However, since we don't use this in the pezkuwi-js code, can kick this
|
||||
* down the line
|
||||
**/
|
||||
export function resolveExtBare (specifier: string, parentUrl: URL | string): Resolved | void {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Adapted from: https://nodejs.org/api/esm.html#esm_transpiler_loader
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import crypto from 'node:crypto';
|
||||
@@ -66,7 +66,7 @@ export async function load (url: string, context: Record<string, unknown>, nextL
|
||||
module: ts.ModuleKind.ESNext,
|
||||
moduleResolution: ts.ModuleResolutionKind.NodeNext,
|
||||
skipLibCheck: true,
|
||||
// Aligns with packages/dev/scripts/polkadot-dev-build-ts & packages/dev/config/tsconfig
|
||||
// Aligns with packages/dev/scripts/pezkuwi-dev-build-ts & packages/dev/config/tsconfig
|
||||
target: ts.ScriptTarget.ES2022
|
||||
},
|
||||
fileName: fileURLToPath(url)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { TsAlias } from './types.js';
|
||||
@@ -66,7 +66,7 @@ function readConfigFile (currentPath = CWD_PATH, tsconfig = 'tsconfig.json', fro
|
||||
|
||||
// base configs are overridden by later configs, order here matters
|
||||
// FIXME The paths would be relative to the baseUrl at that point... for
|
||||
// now we don't care much since we define these 2 together in all @polkadot
|
||||
// now we don't care much since we define these 2 together in all @pezkuwi
|
||||
// configs, but it certainly _may_ create and issue at some point (for others)
|
||||
paths = { ...extConfig.paths, ...paths };
|
||||
url = url || extConfig.url;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017-2025 @polkadot/dev-ts authors & contributors
|
||||
// Copyright 2017-2025 @pezkuwi/dev-ts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export interface TsAlias {
|
||||
|
||||
Reference in New Issue
Block a user