@zntc/core 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/cli-flags.mjs +1 -0
- package/bin/zntc.mjs +5 -1
- package/dist/core/index.d.cts +10 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/index.cjs +9 -3
- package/dist/index.js +11 -2
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ bun add -D browserslist core-js core-js-compat lightningcss
|
|
|
37
37
|
bunx zntc src/index.ts --outfile out.js
|
|
38
38
|
|
|
39
39
|
# Bundle (multi-entry)
|
|
40
|
-
bunx zntc --bundle src/index.ts --outfile dist/bundle.js --format=esm --
|
|
40
|
+
bunx zntc --bundle src/index.ts --outfile dist/bundle.js --format=esm --platform=node
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
See `bunx zntc --help` for the full list of options.
|
package/bin/cli-flags.mjs
CHANGED
|
@@ -239,6 +239,7 @@ export const FLAG_REGISTRY = [
|
|
|
239
239
|
// ─── kind=key-value — `--key:K=V` → opts[target][K]=V ───
|
|
240
240
|
{ kind: 'key-value', flag: '--define', target: 'define' },
|
|
241
241
|
{ kind: 'key-value', flag: '--alias', target: 'alias' },
|
|
242
|
+
{ kind: 'key-value', flag: '--external-alias', target: 'externalAlias' },
|
|
242
243
|
// Fallback resolution — 해석 실패 시에만 적용 (webpack resolve.fallback /
|
|
243
244
|
// Metro extraNodeModules 호환). `--fallback:crypto=crypto-browserify`.
|
|
244
245
|
// 값 "false" → 빈-모듈 강제 + specifier 제약은 normalizeFallback 참조.
|
package/bin/zntc.mjs
CHANGED
|
@@ -296,6 +296,7 @@ function parseArgs(argv) {
|
|
|
296
296
|
packagesExternal: false,
|
|
297
297
|
define: {},
|
|
298
298
|
alias: {},
|
|
299
|
+
externalAlias: {},
|
|
299
300
|
banner: undefined,
|
|
300
301
|
footer: undefined,
|
|
301
302
|
globalName: undefined,
|
|
@@ -1477,7 +1478,7 @@ function mergeConfigIntoOpts(opts, config) {
|
|
|
1477
1478
|
}
|
|
1478
1479
|
}
|
|
1479
1480
|
|
|
1480
|
-
for (const key of ['define', 'alias', 'loader', 'globals', 'fallback']) {
|
|
1481
|
+
for (const key of ['define', 'alias', 'externalAlias', 'loader', 'globals', 'fallback']) {
|
|
1481
1482
|
if (config[key] && typeof config[key] === 'object') {
|
|
1482
1483
|
opts[key] = { ...config[key], ...opts[key] };
|
|
1483
1484
|
}
|
|
@@ -1561,6 +1562,9 @@ async function buildBundleOptions(opts, config, { filterCallerPreWarmCss = false
|
|
|
1561
1562
|
packagesExternal: opts.packagesExternal,
|
|
1562
1563
|
// `--alias:K=V` 플래그 (webpack/rollup 스타일) — JS 옵션이 tsconfig paths 보다 우선 적용됨.
|
|
1563
1564
|
alias: Object.keys(opts.alias).length > 0 ? opts.alias : undefined,
|
|
1565
|
+
// #4616 external 지정자를 다른 이름으로 방출 (rollup output.paths 대응).
|
|
1566
|
+
externalAlias:
|
|
1567
|
+
Object.keys(opts.externalAlias ?? {}).length > 0 ? opts.externalAlias : undefined,
|
|
1564
1568
|
define: Object.keys(opts.define).length > 0 ? opts.define : undefined,
|
|
1565
1569
|
loader: Object.keys(opts.loader).length > 0 ? opts.loader : undefined,
|
|
1566
1570
|
minify: opts.minify,
|
package/dist/core/index.d.cts
CHANGED
|
@@ -625,6 +625,16 @@ interface BuildOptionsCommon {
|
|
|
625
625
|
find: string | RegExp;
|
|
626
626
|
replacement: string;
|
|
627
627
|
}>;
|
|
628
|
+
/**
|
|
629
|
+
* external 로 남는 지정자를 **다른 이름으로 방출** (rollup `output.paths` /
|
|
630
|
+
* webpack object-form `externals` 대응).
|
|
631
|
+
*
|
|
632
|
+
* `alias` 와 달리 **해석에는 관여하지 않는다** — 이미 external 로 확정된 지정자를
|
|
633
|
+
* 출력에 쓸 때만 이름을 바꾼다. 브라우저용 shim 을 번들하지 않고 이름만 갈아끼울 때 쓴다.
|
|
634
|
+
*
|
|
635
|
+
* @example { crypto: 'crypto-browserify' } // import ... from "crypto-browserify"
|
|
636
|
+
*/
|
|
637
|
+
externalAlias?: Record<string, string>;
|
|
628
638
|
/** alias 의 prefix matching 을 끄는 from 목록 — exact 매칭만 허용.
|
|
629
639
|
*
|
|
630
640
|
* `alias` object form 의 기본 동작은 esbuild 처럼 정확/접두사 둘 다 매칭이라
|
package/dist/core/index.d.ts
CHANGED
|
@@ -625,6 +625,16 @@ interface BuildOptionsCommon {
|
|
|
625
625
|
find: string | RegExp;
|
|
626
626
|
replacement: string;
|
|
627
627
|
}>;
|
|
628
|
+
/**
|
|
629
|
+
* external 로 남는 지정자를 **다른 이름으로 방출** (rollup `output.paths` /
|
|
630
|
+
* webpack object-form `externals` 대응).
|
|
631
|
+
*
|
|
632
|
+
* `alias` 와 달리 **해석에는 관여하지 않는다** — 이미 external 로 확정된 지정자를
|
|
633
|
+
* 출력에 쓸 때만 이름을 바꾼다. 브라우저용 shim 을 번들하지 않고 이름만 갈아끼울 때 쓴다.
|
|
634
|
+
*
|
|
635
|
+
* @example { crypto: 'crypto-browserify' } // import ... from "crypto-browserify"
|
|
636
|
+
*/
|
|
637
|
+
externalAlias?: Record<string, string>;
|
|
628
638
|
/** alias 의 prefix matching 을 끄는 from 목록 — exact 매칭만 허용.
|
|
629
639
|
*
|
|
630
640
|
* `alias` object form 의 기본 동작은 esbuild 처럼 정확/접두사 둘 다 매칭이라
|
package/dist/index.cjs
CHANGED
|
@@ -61,7 +61,7 @@ function validateTsConfigRaw(raw) {
|
|
|
61
61
|
}
|
|
62
62
|
function buildOptionsJson(opts={},unsupportedOverride) {
|
|
63
63
|
const payload = {};
|
|
64
|
-
if (opts.target)payload.target = opts.target;
|
|
64
|
+
if (opts.target && ES_TARGET_BITS[opts.target] !== undefined)payload.target = opts.target;
|
|
65
65
|
if (unsupportedOverride !== undefined && unsupportedOverride !== 0)payload.unsupported = unsupportedOverride;
|
|
66
66
|
if (opts.flow)payload.flow = true;
|
|
67
67
|
if (opts.jsxInJs)payload.jsxInJs = true;
|
|
@@ -555,7 +555,7 @@ function warnUnknownKeys(config,known,options={}) {
|
|
|
555
555
|
}
|
|
556
556
|
return result;
|
|
557
557
|
}
|
|
558
|
-
const KNOWN_CONFIG_KEYS = ["entryPoints", "output", "outdir", "outfile", "outbase", "format", "platform", "target", "rnVersion", "diskCache", "cacheDir", "browserslist", "runtimePolyfills", "coreJs", "jsx", "jsxDev", "jsxFactory", "jsxFragment", "jsxImportSource", "jsxInJs", "jsxSideEffects", "minify", "minifyWhitespace", "minifyIdentifiers", "minifySyntax", "sourcemap", "sourcemapMode", "sourcemapDebugIds", "sourcesContent", "sourceRoot", "external", "alias", "aliasExact", "define", "server", "loader", "conditions", "nodePaths", "moduleSpecifierMap", "resolveExtensions", "mainFields", "packagesExternal", "preserveSymlinks", "resolveSymlinkSiblings", "disableHierarchicalLookup", "splitting", "outputExports", "preserveModules", "preserveModulesRoot", "inlineDynamicImports", "manualChunks", "minChunkSize", "metafile", "treeShaking", "shimMissingExports", "keepNames", "drop", "dropConsole", "dropDebugger", "dropLabels", "banner", "footer", "intro", "outro", "inject", "pure", "legalComments", "entryNames", "chunkNames", "assetNames", "assetInlineLimit", "cssNames", "experimentalDecorators", "emitDecoratorMetadata", "useDefineForClassFields", "verbatimModuleSyntax", "tsconfigPath", "tsconfigRaw", "globalName", "globals", "publicPath", "charsetUtf8", "asciiOnly", "quotes", "compiler", "mf", "flow", "plugins", "logLevel", "logLimit", "lineLimit", "profile", "profileFormat", "profileLevel", "tokenizeFormat", "stopAfter", "ignoreAnnotations", "watchDelay", "jobs", "codegenTransform", "lazyCompilation", "lazyForceParse", "preserveSafePlugins", "extends", "root", "projectRoot", "entry", "dev", "outDir", "bundler", "resolver", "transformer", "serializer", "symbolicator", "watchFolders"];
|
|
558
|
+
const KNOWN_CONFIG_KEYS = ["entryPoints", "output", "outdir", "outfile", "outbase", "format", "platform", "target", "rnVersion", "diskCache", "cacheDir", "browserslist", "runtimePolyfills", "coreJs", "jsx", "jsxDev", "jsxFactory", "jsxFragment", "jsxImportSource", "jsxInJs", "jsxSideEffects", "minify", "minifyWhitespace", "minifyIdentifiers", "minifySyntax", "sourcemap", "sourcemapMode", "sourcemapDebugIds", "sourcesContent", "sourceRoot", "external", "alias", "externalAlias", "aliasExact", "define", "server", "loader", "conditions", "nodePaths", "moduleSpecifierMap", "resolveExtensions", "mainFields", "packagesExternal", "preserveSymlinks", "resolveSymlinkSiblings", "disableHierarchicalLookup", "splitting", "outputExports", "preserveModules", "preserveModulesRoot", "inlineDynamicImports", "manualChunks", "minChunkSize", "metafile", "treeShaking", "shimMissingExports", "keepNames", "drop", "dropConsole", "dropDebugger", "dropLabels", "banner", "footer", "intro", "outro", "inject", "pure", "legalComments", "entryNames", "chunkNames", "assetNames", "assetInlineLimit", "cssNames", "experimentalDecorators", "emitDecoratorMetadata", "useDefineForClassFields", "verbatimModuleSyntax", "tsconfigPath", "tsconfigRaw", "globalName", "globals", "publicPath", "charsetUtf8", "asciiOnly", "quotes", "compiler", "mf", "flow", "plugins", "logLevel", "logLimit", "lineLimit", "profile", "profileFormat", "profileLevel", "tokenizeFormat", "stopAfter", "ignoreAnnotations", "watchDelay", "jobs", "codegenTransform", "lazyCompilation", "lazyForceParse", "preserveSafePlugins", "extends", "root", "projectRoot", "entry", "dev", "outDir", "bundler", "resolver", "transformer", "serializer", "symbolicator", "watchFolders"];
|
|
559
559
|
//#endregion
|
|
560
560
|
//#region workspace.ts
|
|
561
561
|
var existsSync$1 = require("node:fs").existsSync;
|
|
@@ -776,7 +776,10 @@ function resolveUnsupported(options) {
|
|
|
776
776
|
}
|
|
777
777
|
return browserslistToUnsupported(bl(options.browserslist));
|
|
778
778
|
}
|
|
779
|
-
|
|
779
|
+
if (!options.target)return 0;
|
|
780
|
+
const esBits = ES_TARGET_BITS[options.target];
|
|
781
|
+
if (esBits !== undefined)return esBits;
|
|
782
|
+
return ensureNative().targetToUnsupported(options.target);
|
|
780
783
|
}
|
|
781
784
|
var TsconfigCache = class {
|
|
782
785
|
_handle;
|
|
@@ -1220,6 +1223,9 @@ function prepareNapiOptions(options) {
|
|
|
1220
1223
|
delete napiOptions.browserslist;
|
|
1221
1224
|
}
|
|
1222
1225
|
if (options.target && !isEsTarget(options.target)) {
|
|
1226
|
+
if (napiOptions.unsupported === undefined) {
|
|
1227
|
+
napiOptions.unsupported = ensureNative().targetToUnsupported(options.target);
|
|
1228
|
+
}
|
|
1223
1229
|
delete napiOptions.target;
|
|
1224
1230
|
}
|
|
1225
1231
|
delete napiOptions.compiler;
|
package/dist/index.js
CHANGED
|
@@ -1240,7 +1240,7 @@ function validateTsConfigRaw(raw) {
|
|
|
1240
1240
|
}
|
|
1241
1241
|
function buildOptionsJson(opts = {}, unsupportedOverride) {
|
|
1242
1242
|
const payload = {};
|
|
1243
|
-
if (opts.target)
|
|
1243
|
+
if (opts.target && ES_TARGET_BITS[opts.target] !== undefined)
|
|
1244
1244
|
payload.target = opts.target;
|
|
1245
1245
|
if (unsupportedOverride !== undefined && unsupportedOverride !== 0)
|
|
1246
1246
|
payload.unsupported = unsupportedOverride;
|
|
@@ -2244,6 +2244,7 @@ var KNOWN_CONFIG_KEYS = [
|
|
|
2244
2244
|
"sourceRoot",
|
|
2245
2245
|
"external",
|
|
2246
2246
|
"alias",
|
|
2247
|
+
"externalAlias",
|
|
2247
2248
|
"aliasExact",
|
|
2248
2249
|
"define",
|
|
2249
2250
|
"server",
|
|
@@ -2574,7 +2575,12 @@ function resolveUnsupported(options) {
|
|
|
2574
2575
|
}
|
|
2575
2576
|
return browserslistToUnsupported(bl(options.browserslist));
|
|
2576
2577
|
}
|
|
2577
|
-
|
|
2578
|
+
if (!options.target)
|
|
2579
|
+
return 0;
|
|
2580
|
+
const esBits = ES_TARGET_BITS[options.target];
|
|
2581
|
+
if (esBits !== undefined)
|
|
2582
|
+
return esBits;
|
|
2583
|
+
return ensureNative().targetToUnsupported(options.target);
|
|
2578
2584
|
}
|
|
2579
2585
|
|
|
2580
2586
|
class TsconfigCache {
|
|
@@ -3183,6 +3189,9 @@ function prepareNapiOptions(options) {
|
|
|
3183
3189
|
delete napiOptions.browserslist;
|
|
3184
3190
|
}
|
|
3185
3191
|
if (options.target && !isEsTarget(options.target)) {
|
|
3192
|
+
if (napiOptions.unsupported === undefined) {
|
|
3193
|
+
napiOptions.unsupported = ensureNative().targetToUnsupported(options.target);
|
|
3194
|
+
}
|
|
3186
3195
|
delete napiOptions.target;
|
|
3187
3196
|
}
|
|
3188
3197
|
delete napiOptions.compiler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zntc/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "ZNTC native transpiler & compiler binding",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bundler",
|
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
"@zntc/test-helpers": "0.0.0"
|
|
77
77
|
},
|
|
78
78
|
"optionalDependencies": {
|
|
79
|
-
"@zntc/core-darwin-arm64": "0.1.
|
|
80
|
-
"@zntc/core-darwin-x64": "0.1.
|
|
81
|
-
"@zntc/core-linux-arm64-gnu": "0.1.
|
|
82
|
-
"@zntc/core-linux-arm64-musl": "0.1.
|
|
83
|
-
"@zntc/core-linux-x64-gnu": "0.1.
|
|
84
|
-
"@zntc/core-linux-x64-musl": "0.1.
|
|
85
|
-
"@zntc/core-win32-arm64-msvc": "0.1.
|
|
86
|
-
"@zntc/core-win32-ia32-msvc": "0.1.
|
|
87
|
-
"@zntc/core-win32-x64-msvc": "0.1.
|
|
79
|
+
"@zntc/core-darwin-arm64": "0.1.5",
|
|
80
|
+
"@zntc/core-darwin-x64": "0.1.5",
|
|
81
|
+
"@zntc/core-linux-arm64-gnu": "0.1.5",
|
|
82
|
+
"@zntc/core-linux-arm64-musl": "0.1.5",
|
|
83
|
+
"@zntc/core-linux-x64-gnu": "0.1.5",
|
|
84
|
+
"@zntc/core-linux-x64-musl": "0.1.5",
|
|
85
|
+
"@zntc/core-win32-arm64-msvc": "0.1.5",
|
|
86
|
+
"@zntc/core-win32-ia32-msvc": "0.1.5",
|
|
87
|
+
"@zntc/core-win32-x64-msvc": "0.1.5",
|
|
88
88
|
"browserslist": "^4.24.0",
|
|
89
89
|
"core-js": "^3.49.0",
|
|
90
90
|
"core-js-compat": "^3.49.0",
|