@zeus-js/bundler-plugin 0.1.0-beta.5 → 0.1.0-beta.7
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/dist/bundler-plugin.cjs.js +25 -30
- package/dist/bundler-plugin.cjs.prod.js +25 -30
- package/dist/bundler-plugin.esm-bundler.js +32 -43
- package/dist/outputPlugins/manifest.cjs.js +1 -1
- package/dist/outputPlugins/manifest.cjs.prod.js +1 -1
- package/dist/outputPlugins/manifest.js +1 -1
- package/dist/outputPlugins/manifest.prod.js +1 -1
- package/dist/rolldown.cjs.js +25 -30
- package/dist/rolldown.cjs.prod.js +25 -30
- package/dist/rolldown.js +32 -43
- package/dist/rolldown.prod.js +32 -43
- package/dist/rollup.cjs.js +25 -30
- package/dist/rollup.cjs.prod.js +25 -30
- package/dist/rollup.js +32 -43
- package/dist/rollup.prod.js +32 -43
- package/dist/vite.cjs.js +25 -30
- package/dist/vite.cjs.prod.js +25 -30
- package/dist/vite.js +30 -41
- package/dist/vite.prod.js +30 -41
- package/package.json +46 -38
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bundler-plugin v0.1.0-beta.
|
|
2
|
+
* bundler-plugin v0.1.0-beta.7
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -34,15 +34,15 @@ node_fs = __toESM(node_fs, 1);
|
|
|
34
34
|
let node_path = require("node:path");
|
|
35
35
|
node_path = __toESM(node_path, 1);
|
|
36
36
|
let _zeus_js_component_analyzer = require("@zeus-js/component-analyzer");
|
|
37
|
-
let fast_glob = require("fast-glob");
|
|
38
|
-
fast_glob = __toESM(fast_glob, 1);
|
|
39
37
|
let picomatch = require("picomatch");
|
|
40
38
|
picomatch = __toESM(picomatch, 1);
|
|
41
39
|
let node_fs_promises = require("node:fs/promises");
|
|
42
40
|
node_fs_promises = __toESM(node_fs_promises, 1);
|
|
41
|
+
let fast_glob = require("fast-glob");
|
|
42
|
+
fast_glob = __toESM(fast_glob, 1);
|
|
43
43
|
let _babel_core = require("@babel/core");
|
|
44
|
-
let
|
|
45
|
-
|
|
44
|
+
let _babel_plugin_transform_typescript = require("@babel/plugin-transform-typescript");
|
|
45
|
+
_babel_plugin_transform_typescript = __toESM(_babel_plugin_transform_typescript, 1);
|
|
46
46
|
let _zeus_js_compiler = require("@zeus-js/compiler");
|
|
47
47
|
_zeus_js_compiler = __toESM(_zeus_js_compiler, 1);
|
|
48
48
|
//#region packages/web-c/bundler-plugin/src/filter.ts
|
|
@@ -97,7 +97,7 @@ function resolveComponentExclude(exclude) {
|
|
|
97
97
|
}
|
|
98
98
|
function resolveTransformInclude(include, componentInclude) {
|
|
99
99
|
if (include === null || include === void 0 ? void 0 : include.length) return include;
|
|
100
|
-
return Array.from(new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
100
|
+
return Array.from(/* @__PURE__ */ new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
101
101
|
}
|
|
102
102
|
function resolveTransformExclude(exclude) {
|
|
103
103
|
return (exclude === null || exclude === void 0 ? void 0 : exclude.length) ? exclude : DEFAULT_TRANSFORM_EXCLUDE;
|
|
@@ -277,29 +277,29 @@ function normalizeTagName(tag, stripPrefix) {
|
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region packages/web-c/bundler-plugin/src/transform.ts
|
|
279
279
|
async function transformZeus(options) {
|
|
280
|
-
var _compilerOptions$modu;
|
|
281
280
|
const { id, code, compiler, sourcemap = true, transpile = false } = options;
|
|
281
|
+
const filename = cleanUrl(id);
|
|
282
282
|
const isTs = isTypeScriptLike(id);
|
|
283
|
-
const isTsx = /\.[cm]?tsx$/.test(id.replace(/[?#].*$/, ""));
|
|
284
283
|
const shouldRunCompiler = compiler !== false;
|
|
285
284
|
const shouldStripTs = transpile && isTs;
|
|
286
285
|
if (!shouldRunCompiler && !shouldStripTs) return null;
|
|
287
286
|
const compilerOptions = compiler === false ? {} : compiler === void 0 ? {} : compiler;
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
plugins
|
|
287
|
+
const plugins = [];
|
|
288
|
+
if (shouldRunCompiler) {
|
|
289
|
+
var _compilerOptions$modu;
|
|
290
|
+
plugins.push([_zeus_js_compiler.default, {
|
|
292
291
|
moduleName: (_compilerOptions$modu = compilerOptions.moduleName) !== null && _compilerOptions$modu !== void 0 ? _compilerOptions$modu : "@zeus-js/runtime-dom",
|
|
293
292
|
generate: "dom",
|
|
294
293
|
hydratable: false,
|
|
295
294
|
delegateEvents: true,
|
|
296
295
|
...compilerOptions
|
|
297
|
-
}]
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
296
|
+
}]);
|
|
297
|
+
}
|
|
298
|
+
if (shouldStripTs) plugins.push([_babel_plugin_transform_typescript.default, {}]);
|
|
299
|
+
const result = await (0, _babel_core.transformAsync)(code, {
|
|
300
|
+
filename,
|
|
301
|
+
sourceMaps: sourcemap,
|
|
302
|
+
plugins,
|
|
303
303
|
parserOpts: {
|
|
304
304
|
sourceType: "module",
|
|
305
305
|
plugins: ["typescript", "jsx"]
|
|
@@ -457,7 +457,7 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
457
457
|
exclude: componentExclude
|
|
458
458
|
});
|
|
459
459
|
const manifestResult = await createManifest(root, componentInclude, componentExclude);
|
|
460
|
-
for (const file of
|
|
460
|
+
for (const file of manifestResult.dependencies) this.addWatchFile(file);
|
|
461
461
|
const diagnostics = manifestResult.diagnostics;
|
|
462
462
|
for (const diagnostic of diagnostics) {
|
|
463
463
|
const message = formatDiagnostic(diagnostic);
|
|
@@ -522,13 +522,15 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
522
522
|
const shouldRunZeus = shouldCompileZeus(id);
|
|
523
523
|
const shouldStripTs = resolveTranspile(options.transpile, target) && isTypeScriptLike(id);
|
|
524
524
|
if (!shouldRunZeus && !shouldStripTs) return null;
|
|
525
|
-
|
|
525
|
+
const result = await transformZeus({
|
|
526
526
|
id,
|
|
527
527
|
code,
|
|
528
528
|
compiler: shouldRunZeus ? options.compiler : false,
|
|
529
529
|
sourcemap: true,
|
|
530
530
|
transpile: shouldStripTs
|
|
531
531
|
});
|
|
532
|
+
if (!result) return null;
|
|
533
|
+
return result;
|
|
532
534
|
},
|
|
533
535
|
async generateBundle(_, bundle) {
|
|
534
536
|
var _options$plugins2;
|
|
@@ -587,22 +589,15 @@ async function createManifest(root, include, exclude) {
|
|
|
587
589
|
version: 1,
|
|
588
590
|
components: []
|
|
589
591
|
},
|
|
590
|
-
diagnostics: []
|
|
592
|
+
diagnostics: [],
|
|
593
|
+
dependencies: []
|
|
591
594
|
};
|
|
592
|
-
return await (0, _zeus_js_component_analyzer.
|
|
595
|
+
return await (0, _zeus_js_component_analyzer.analyzeComponentsWithDependencies)({
|
|
593
596
|
root,
|
|
594
597
|
include,
|
|
595
598
|
exclude
|
|
596
599
|
});
|
|
597
600
|
}
|
|
598
|
-
async function collectWatchFiles(root, include, exclude) {
|
|
599
|
-
if (!include.length) return [];
|
|
600
|
-
return await (0, fast_glob.default)(include, {
|
|
601
|
-
cwd: root,
|
|
602
|
-
absolute: true,
|
|
603
|
-
ignore: exclude
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
601
|
function resolveTsLikeImport(id, importer, options) {
|
|
607
602
|
var _options$extensions;
|
|
608
603
|
if (!importer) return null;
|
package/dist/rolldown.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bundler-plugin v0.1.0-beta.
|
|
2
|
+
* bundler-plugin v0.1.0-beta.7
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
import {
|
|
9
|
-
import fg from "fast-glob";
|
|
8
|
+
import { analyzeComponentsWithDependencies } from "@zeus-js/component-analyzer";
|
|
10
9
|
import picomatch from "picomatch";
|
|
11
10
|
import fs$1 from "node:fs/promises";
|
|
11
|
+
import fg from "fast-glob";
|
|
12
12
|
import { transformAsync } from "@babel/core";
|
|
13
|
-
import
|
|
13
|
+
import transformTypeScript from "@babel/plugin-transform-typescript";
|
|
14
14
|
import zeusCompiler from "@zeus-js/compiler";
|
|
15
15
|
//#region packages/web-c/bundler-plugin/src/filter.ts
|
|
16
16
|
function cleanUrl(id) {
|
|
@@ -64,7 +64,7 @@ function resolveComponentExclude(exclude) {
|
|
|
64
64
|
}
|
|
65
65
|
function resolveTransformInclude(include, componentInclude) {
|
|
66
66
|
if (include === null || include === void 0 ? void 0 : include.length) return include;
|
|
67
|
-
return Array.from(new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
67
|
+
return Array.from(/* @__PURE__ */ new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
68
68
|
}
|
|
69
69
|
function resolveTransformExclude(exclude) {
|
|
70
70
|
return (exclude === null || exclude === void 0 ? void 0 : exclude.length) ? exclude : DEFAULT_TRANSFORM_EXCLUDE;
|
|
@@ -78,7 +78,7 @@ function hasErrorDiagnostics(diagnostics) {
|
|
|
78
78
|
return diagnostics.some((item) => item.level === "error");
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
|
-
//#region \0@oxc-project+runtime@0.
|
|
81
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/asyncToGenerator.js
|
|
82
82
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
83
83
|
try {
|
|
84
84
|
var i = n[a](c), u = i.value;
|
|
@@ -104,7 +104,7 @@ function _asyncToGenerator(n) {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
//#endregion
|
|
107
|
-
//#region \0@oxc-project+runtime@0.
|
|
107
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
|
|
108
108
|
function _typeof(o) {
|
|
109
109
|
"@babel/helpers - typeof";
|
|
110
110
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -114,7 +114,7 @@ function _typeof(o) {
|
|
|
114
114
|
}, _typeof(o);
|
|
115
115
|
}
|
|
116
116
|
//#endregion
|
|
117
|
-
//#region \0@oxc-project+runtime@0.
|
|
117
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
|
|
118
118
|
function toPrimitive(t, r) {
|
|
119
119
|
if ("object" != _typeof(t) || !t) return t;
|
|
120
120
|
var e = t[Symbol.toPrimitive];
|
|
@@ -126,13 +126,13 @@ function toPrimitive(t, r) {
|
|
|
126
126
|
return ("string" === r ? String : Number)(t);
|
|
127
127
|
}
|
|
128
128
|
//#endregion
|
|
129
|
-
//#region \0@oxc-project+runtime@0.
|
|
129
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
|
|
130
130
|
function toPropertyKey(t) {
|
|
131
131
|
var i = toPrimitive(t, "string");
|
|
132
132
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
133
133
|
}
|
|
134
134
|
//#endregion
|
|
135
|
-
//#region \0@oxc-project+runtime@0.
|
|
135
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
|
|
136
136
|
function _defineProperty(e, r, t) {
|
|
137
137
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
138
138
|
value: t,
|
|
@@ -142,7 +142,7 @@ function _defineProperty(e, r, t) {
|
|
|
142
142
|
}) : e[r] = t, e;
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
|
-
//#region \0@oxc-project+runtime@0.
|
|
145
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/objectSpread2.js
|
|
146
146
|
function ownKeys(e, r) {
|
|
147
147
|
var t = Object.keys(e);
|
|
148
148
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -366,28 +366,28 @@ function transformZeus(_x) {
|
|
|
366
366
|
}
|
|
367
367
|
function _transformZeus() {
|
|
368
368
|
_transformZeus = _asyncToGenerator(function* (options) {
|
|
369
|
-
var _compilerOptions$modu;
|
|
370
369
|
const { id, code, compiler, sourcemap = true, transpile = false } = options;
|
|
370
|
+
const filename = cleanUrl(id);
|
|
371
371
|
const isTs = isTypeScriptLike(id);
|
|
372
|
-
const isTsx = /\.[cm]?tsx$/.test(id.replace(/[?#].*$/, ""));
|
|
373
372
|
const shouldRunCompiler = compiler !== false;
|
|
374
373
|
const shouldStripTs = transpile && isTs;
|
|
375
374
|
if (!shouldRunCompiler && !shouldStripTs) return null;
|
|
376
375
|
const compilerOptions = compiler === false ? {} : compiler === void 0 ? {} : compiler;
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
plugins
|
|
376
|
+
const plugins = [];
|
|
377
|
+
if (shouldRunCompiler) {
|
|
378
|
+
var _compilerOptions$modu;
|
|
379
|
+
plugins.push([zeusCompiler, _objectSpread2({
|
|
381
380
|
moduleName: (_compilerOptions$modu = compilerOptions.moduleName) !== null && _compilerOptions$modu !== void 0 ? _compilerOptions$modu : "@zeus-js/runtime-dom",
|
|
382
381
|
generate: "dom",
|
|
383
382
|
hydratable: false,
|
|
384
383
|
delegateEvents: true
|
|
385
|
-
}, compilerOptions)]
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
384
|
+
}, compilerOptions)]);
|
|
385
|
+
}
|
|
386
|
+
if (shouldStripTs) plugins.push([transformTypeScript, {}]);
|
|
387
|
+
const result = yield transformAsync(code, {
|
|
388
|
+
filename,
|
|
389
|
+
sourceMaps: sourcemap,
|
|
390
|
+
plugins,
|
|
391
391
|
parserOpts: {
|
|
392
392
|
sourceType: "module",
|
|
393
393
|
plugins: ["typescript", "jsx"]
|
|
@@ -543,7 +543,7 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
543
543
|
exclude: componentExclude
|
|
544
544
|
});
|
|
545
545
|
const manifestResult = yield createManifest(root, componentInclude, componentExclude);
|
|
546
|
-
for (const file of
|
|
546
|
+
for (const file of manifestResult.dependencies) _this.addWatchFile(file);
|
|
547
547
|
const diagnostics = manifestResult.diagnostics;
|
|
548
548
|
for (const diagnostic of diagnostics) {
|
|
549
549
|
const message = formatDiagnostic(diagnostic);
|
|
@@ -610,13 +610,15 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
610
610
|
const shouldRunZeus = shouldCompileZeus(id);
|
|
611
611
|
const shouldStripTs = resolveTranspile(options.transpile, target) && isTypeScriptLike(id);
|
|
612
612
|
if (!shouldRunZeus && !shouldStripTs) return null;
|
|
613
|
-
|
|
613
|
+
const result = yield transformZeus({
|
|
614
614
|
id,
|
|
615
615
|
code,
|
|
616
616
|
compiler: shouldRunZeus ? options.compiler : false,
|
|
617
617
|
sourcemap: true,
|
|
618
618
|
transpile: shouldStripTs
|
|
619
619
|
});
|
|
620
|
+
if (!result) return null;
|
|
621
|
+
return result;
|
|
620
622
|
})();
|
|
621
623
|
},
|
|
622
624
|
generateBundle(_, bundle) {
|
|
@@ -683,9 +685,10 @@ function _createManifest() {
|
|
|
683
685
|
version: 1,
|
|
684
686
|
components: []
|
|
685
687
|
},
|
|
686
|
-
diagnostics: []
|
|
688
|
+
diagnostics: [],
|
|
689
|
+
dependencies: []
|
|
687
690
|
};
|
|
688
|
-
return yield
|
|
691
|
+
return yield analyzeComponentsWithDependencies({
|
|
689
692
|
root,
|
|
690
693
|
include,
|
|
691
694
|
exclude
|
|
@@ -693,20 +696,6 @@ function _createManifest() {
|
|
|
693
696
|
});
|
|
694
697
|
return _createManifest.apply(this, arguments);
|
|
695
698
|
}
|
|
696
|
-
function collectWatchFiles(_x4, _x5, _x6) {
|
|
697
|
-
return _collectWatchFiles.apply(this, arguments);
|
|
698
|
-
}
|
|
699
|
-
function _collectWatchFiles() {
|
|
700
|
-
_collectWatchFiles = _asyncToGenerator(function* (root, include, exclude) {
|
|
701
|
-
if (!include.length) return [];
|
|
702
|
-
return yield fg(include, {
|
|
703
|
-
cwd: root,
|
|
704
|
-
absolute: true,
|
|
705
|
-
ignore: exclude
|
|
706
|
-
});
|
|
707
|
-
});
|
|
708
|
-
return _collectWatchFiles.apply(this, arguments);
|
|
709
|
-
}
|
|
710
699
|
function resolveTsLikeImport(id, importer, options) {
|
|
711
700
|
var _options$extensions;
|
|
712
701
|
if (!importer) return null;
|
|
@@ -772,7 +761,7 @@ function resolveVirtualEntryImport(id, importer) {
|
|
|
772
761
|
return `${importer.slice(0, lastColon + 1)}entry:${tagName}`;
|
|
773
762
|
}
|
|
774
763
|
//#endregion
|
|
775
|
-
//#region \0@oxc-project+runtime@0.
|
|
764
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
776
765
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
777
766
|
if (null == r) return {};
|
|
778
767
|
var t = {};
|
|
@@ -783,7 +772,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
783
772
|
return t;
|
|
784
773
|
}
|
|
785
774
|
//#endregion
|
|
786
|
-
//#region \0@oxc-project+runtime@0.
|
|
775
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/objectWithoutProperties.js
|
|
787
776
|
function _objectWithoutProperties(e, t) {
|
|
788
777
|
if (null == e) return {};
|
|
789
778
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
package/dist/rolldown.prod.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bundler-plugin v0.1.0-beta.
|
|
2
|
+
* bundler-plugin v0.1.0-beta.7
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
import {
|
|
9
|
-
import fg from "fast-glob";
|
|
8
|
+
import { analyzeComponentsWithDependencies } from "@zeus-js/component-analyzer";
|
|
10
9
|
import picomatch from "picomatch";
|
|
11
10
|
import fs$1 from "node:fs/promises";
|
|
11
|
+
import fg from "fast-glob";
|
|
12
12
|
import { transformAsync } from "@babel/core";
|
|
13
|
-
import
|
|
13
|
+
import transformTypeScript from "@babel/plugin-transform-typescript";
|
|
14
14
|
import zeusCompiler from "@zeus-js/compiler";
|
|
15
15
|
//#region packages/web-c/bundler-plugin/src/filter.ts
|
|
16
16
|
function cleanUrl(id) {
|
|
@@ -64,7 +64,7 @@ function resolveComponentExclude(exclude) {
|
|
|
64
64
|
}
|
|
65
65
|
function resolveTransformInclude(include, componentInclude) {
|
|
66
66
|
if (include === null || include === void 0 ? void 0 : include.length) return include;
|
|
67
|
-
return Array.from(new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
67
|
+
return Array.from(/* @__PURE__ */ new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
68
68
|
}
|
|
69
69
|
function resolveTransformExclude(exclude) {
|
|
70
70
|
return (exclude === null || exclude === void 0 ? void 0 : exclude.length) ? exclude : DEFAULT_TRANSFORM_EXCLUDE;
|
|
@@ -78,7 +78,7 @@ function hasErrorDiagnostics(diagnostics) {
|
|
|
78
78
|
return diagnostics.some((item) => item.level === "error");
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
|
-
//#region \0@oxc-project+runtime@0.
|
|
81
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/asyncToGenerator.js
|
|
82
82
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
83
83
|
try {
|
|
84
84
|
var i = n[a](c), u = i.value;
|
|
@@ -104,7 +104,7 @@ function _asyncToGenerator(n) {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
//#endregion
|
|
107
|
-
//#region \0@oxc-project+runtime@0.
|
|
107
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
|
|
108
108
|
function _typeof(o) {
|
|
109
109
|
"@babel/helpers - typeof";
|
|
110
110
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -114,7 +114,7 @@ function _typeof(o) {
|
|
|
114
114
|
}, _typeof(o);
|
|
115
115
|
}
|
|
116
116
|
//#endregion
|
|
117
|
-
//#region \0@oxc-project+runtime@0.
|
|
117
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
|
|
118
118
|
function toPrimitive(t, r) {
|
|
119
119
|
if ("object" != _typeof(t) || !t) return t;
|
|
120
120
|
var e = t[Symbol.toPrimitive];
|
|
@@ -126,13 +126,13 @@ function toPrimitive(t, r) {
|
|
|
126
126
|
return ("string" === r ? String : Number)(t);
|
|
127
127
|
}
|
|
128
128
|
//#endregion
|
|
129
|
-
//#region \0@oxc-project+runtime@0.
|
|
129
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
|
|
130
130
|
function toPropertyKey(t) {
|
|
131
131
|
var i = toPrimitive(t, "string");
|
|
132
132
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
133
133
|
}
|
|
134
134
|
//#endregion
|
|
135
|
-
//#region \0@oxc-project+runtime@0.
|
|
135
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
|
|
136
136
|
function _defineProperty(e, r, t) {
|
|
137
137
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
138
138
|
value: t,
|
|
@@ -142,7 +142,7 @@ function _defineProperty(e, r, t) {
|
|
|
142
142
|
}) : e[r] = t, e;
|
|
143
143
|
}
|
|
144
144
|
//#endregion
|
|
145
|
-
//#region \0@oxc-project+runtime@0.
|
|
145
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/objectSpread2.js
|
|
146
146
|
function ownKeys(e, r) {
|
|
147
147
|
var t = Object.keys(e);
|
|
148
148
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -366,28 +366,28 @@ function transformZeus(_x) {
|
|
|
366
366
|
}
|
|
367
367
|
function _transformZeus() {
|
|
368
368
|
_transformZeus = _asyncToGenerator(function* (options) {
|
|
369
|
-
var _compilerOptions$modu;
|
|
370
369
|
const { id, code, compiler, sourcemap = true, transpile = false } = options;
|
|
370
|
+
const filename = cleanUrl(id);
|
|
371
371
|
const isTs = isTypeScriptLike(id);
|
|
372
|
-
const isTsx = /\.[cm]?tsx$/.test(id.replace(/[?#].*$/, ""));
|
|
373
372
|
const shouldRunCompiler = compiler !== false;
|
|
374
373
|
const shouldStripTs = transpile && isTs;
|
|
375
374
|
if (!shouldRunCompiler && !shouldStripTs) return null;
|
|
376
375
|
const compilerOptions = compiler === false ? {} : compiler === void 0 ? {} : compiler;
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
plugins
|
|
376
|
+
const plugins = [];
|
|
377
|
+
if (shouldRunCompiler) {
|
|
378
|
+
var _compilerOptions$modu;
|
|
379
|
+
plugins.push([zeusCompiler, _objectSpread2({
|
|
381
380
|
moduleName: (_compilerOptions$modu = compilerOptions.moduleName) !== null && _compilerOptions$modu !== void 0 ? _compilerOptions$modu : "@zeus-js/runtime-dom",
|
|
382
381
|
generate: "dom",
|
|
383
382
|
hydratable: false,
|
|
384
383
|
delegateEvents: true
|
|
385
|
-
}, compilerOptions)]
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
384
|
+
}, compilerOptions)]);
|
|
385
|
+
}
|
|
386
|
+
if (shouldStripTs) plugins.push([transformTypeScript, {}]);
|
|
387
|
+
const result = yield transformAsync(code, {
|
|
388
|
+
filename,
|
|
389
|
+
sourceMaps: sourcemap,
|
|
390
|
+
plugins,
|
|
391
391
|
parserOpts: {
|
|
392
392
|
sourceType: "module",
|
|
393
393
|
plugins: ["typescript", "jsx"]
|
|
@@ -543,7 +543,7 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
543
543
|
exclude: componentExclude
|
|
544
544
|
});
|
|
545
545
|
const manifestResult = yield createManifest(root, componentInclude, componentExclude);
|
|
546
|
-
for (const file of
|
|
546
|
+
for (const file of manifestResult.dependencies) _this.addWatchFile(file);
|
|
547
547
|
const diagnostics = manifestResult.diagnostics;
|
|
548
548
|
for (const diagnostic of diagnostics) {
|
|
549
549
|
const message = formatDiagnostic(diagnostic);
|
|
@@ -610,13 +610,15 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
610
610
|
const shouldRunZeus = shouldCompileZeus(id);
|
|
611
611
|
const shouldStripTs = resolveTranspile(options.transpile, target) && isTypeScriptLike(id);
|
|
612
612
|
if (!shouldRunZeus && !shouldStripTs) return null;
|
|
613
|
-
|
|
613
|
+
const result = yield transformZeus({
|
|
614
614
|
id,
|
|
615
615
|
code,
|
|
616
616
|
compiler: shouldRunZeus ? options.compiler : false,
|
|
617
617
|
sourcemap: true,
|
|
618
618
|
transpile: shouldStripTs
|
|
619
619
|
});
|
|
620
|
+
if (!result) return null;
|
|
621
|
+
return result;
|
|
620
622
|
})();
|
|
621
623
|
},
|
|
622
624
|
generateBundle(_, bundle) {
|
|
@@ -683,9 +685,10 @@ function _createManifest() {
|
|
|
683
685
|
version: 1,
|
|
684
686
|
components: []
|
|
685
687
|
},
|
|
686
|
-
diagnostics: []
|
|
688
|
+
diagnostics: [],
|
|
689
|
+
dependencies: []
|
|
687
690
|
};
|
|
688
|
-
return yield
|
|
691
|
+
return yield analyzeComponentsWithDependencies({
|
|
689
692
|
root,
|
|
690
693
|
include,
|
|
691
694
|
exclude
|
|
@@ -693,20 +696,6 @@ function _createManifest() {
|
|
|
693
696
|
});
|
|
694
697
|
return _createManifest.apply(this, arguments);
|
|
695
698
|
}
|
|
696
|
-
function collectWatchFiles(_x4, _x5, _x6) {
|
|
697
|
-
return _collectWatchFiles.apply(this, arguments);
|
|
698
|
-
}
|
|
699
|
-
function _collectWatchFiles() {
|
|
700
|
-
_collectWatchFiles = _asyncToGenerator(function* (root, include, exclude) {
|
|
701
|
-
if (!include.length) return [];
|
|
702
|
-
return yield fg(include, {
|
|
703
|
-
cwd: root,
|
|
704
|
-
absolute: true,
|
|
705
|
-
ignore: exclude
|
|
706
|
-
});
|
|
707
|
-
});
|
|
708
|
-
return _collectWatchFiles.apply(this, arguments);
|
|
709
|
-
}
|
|
710
699
|
function resolveTsLikeImport(id, importer, options) {
|
|
711
700
|
var _options$extensions;
|
|
712
701
|
if (!importer) return null;
|
|
@@ -772,7 +761,7 @@ function resolveVirtualEntryImport(id, importer) {
|
|
|
772
761
|
return `${importer.slice(0, lastColon + 1)}entry:${tagName}`;
|
|
773
762
|
}
|
|
774
763
|
//#endregion
|
|
775
|
-
//#region \0@oxc-project+runtime@0.
|
|
764
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
776
765
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
777
766
|
if (null == r) return {};
|
|
778
767
|
var t = {};
|
|
@@ -783,7 +772,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
783
772
|
return t;
|
|
784
773
|
}
|
|
785
774
|
//#endregion
|
|
786
|
-
//#region \0@oxc-project+runtime@0.
|
|
775
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/objectWithoutProperties.js
|
|
787
776
|
function _objectWithoutProperties(e, t) {
|
|
788
777
|
if (null == e) return {};
|
|
789
778
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
package/dist/rollup.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bundler-plugin v0.1.0-beta.
|
|
2
|
+
* bundler-plugin v0.1.0-beta.7
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -34,15 +34,15 @@ node_fs = __toESM(node_fs, 1);
|
|
|
34
34
|
let node_path = require("node:path");
|
|
35
35
|
node_path = __toESM(node_path, 1);
|
|
36
36
|
let _zeus_js_component_analyzer = require("@zeus-js/component-analyzer");
|
|
37
|
-
let fast_glob = require("fast-glob");
|
|
38
|
-
fast_glob = __toESM(fast_glob, 1);
|
|
39
37
|
let picomatch = require("picomatch");
|
|
40
38
|
picomatch = __toESM(picomatch, 1);
|
|
41
39
|
let node_fs_promises = require("node:fs/promises");
|
|
42
40
|
node_fs_promises = __toESM(node_fs_promises, 1);
|
|
41
|
+
let fast_glob = require("fast-glob");
|
|
42
|
+
fast_glob = __toESM(fast_glob, 1);
|
|
43
43
|
let _babel_core = require("@babel/core");
|
|
44
|
-
let
|
|
45
|
-
|
|
44
|
+
let _babel_plugin_transform_typescript = require("@babel/plugin-transform-typescript");
|
|
45
|
+
_babel_plugin_transform_typescript = __toESM(_babel_plugin_transform_typescript, 1);
|
|
46
46
|
let _zeus_js_compiler = require("@zeus-js/compiler");
|
|
47
47
|
_zeus_js_compiler = __toESM(_zeus_js_compiler, 1);
|
|
48
48
|
//#region packages/web-c/bundler-plugin/src/filter.ts
|
|
@@ -97,7 +97,7 @@ function resolveComponentExclude(exclude) {
|
|
|
97
97
|
}
|
|
98
98
|
function resolveTransformInclude(include, componentInclude) {
|
|
99
99
|
if (include === null || include === void 0 ? void 0 : include.length) return include;
|
|
100
|
-
return Array.from(new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
100
|
+
return Array.from(/* @__PURE__ */ new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
101
101
|
}
|
|
102
102
|
function resolveTransformExclude(exclude) {
|
|
103
103
|
return (exclude === null || exclude === void 0 ? void 0 : exclude.length) ? exclude : DEFAULT_TRANSFORM_EXCLUDE;
|
|
@@ -277,29 +277,29 @@ function normalizeTagName(tag, stripPrefix) {
|
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region packages/web-c/bundler-plugin/src/transform.ts
|
|
279
279
|
async function transformZeus(options) {
|
|
280
|
-
var _compilerOptions$modu;
|
|
281
280
|
const { id, code, compiler, sourcemap = true, transpile = false } = options;
|
|
281
|
+
const filename = cleanUrl(id);
|
|
282
282
|
const isTs = isTypeScriptLike(id);
|
|
283
|
-
const isTsx = /\.[cm]?tsx$/.test(id.replace(/[?#].*$/, ""));
|
|
284
283
|
const shouldRunCompiler = compiler !== false;
|
|
285
284
|
const shouldStripTs = transpile && isTs;
|
|
286
285
|
if (!shouldRunCompiler && !shouldStripTs) return null;
|
|
287
286
|
const compilerOptions = compiler === false ? {} : compiler === void 0 ? {} : compiler;
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
plugins
|
|
287
|
+
const plugins = [];
|
|
288
|
+
if (shouldRunCompiler) {
|
|
289
|
+
var _compilerOptions$modu;
|
|
290
|
+
plugins.push([_zeus_js_compiler.default, {
|
|
292
291
|
moduleName: (_compilerOptions$modu = compilerOptions.moduleName) !== null && _compilerOptions$modu !== void 0 ? _compilerOptions$modu : "@zeus-js/runtime-dom",
|
|
293
292
|
generate: "dom",
|
|
294
293
|
hydratable: false,
|
|
295
294
|
delegateEvents: true,
|
|
296
295
|
...compilerOptions
|
|
297
|
-
}]
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
296
|
+
}]);
|
|
297
|
+
}
|
|
298
|
+
if (shouldStripTs) plugins.push([_babel_plugin_transform_typescript.default, {}]);
|
|
299
|
+
const result = await (0, _babel_core.transformAsync)(code, {
|
|
300
|
+
filename,
|
|
301
|
+
sourceMaps: sourcemap,
|
|
302
|
+
plugins,
|
|
303
303
|
parserOpts: {
|
|
304
304
|
sourceType: "module",
|
|
305
305
|
plugins: ["typescript", "jsx"]
|
|
@@ -457,7 +457,7 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
457
457
|
exclude: componentExclude
|
|
458
458
|
});
|
|
459
459
|
const manifestResult = await createManifest(root, componentInclude, componentExclude);
|
|
460
|
-
for (const file of
|
|
460
|
+
for (const file of manifestResult.dependencies) this.addWatchFile(file);
|
|
461
461
|
const diagnostics = manifestResult.diagnostics;
|
|
462
462
|
for (const diagnostic of diagnostics) {
|
|
463
463
|
const message = formatDiagnostic(diagnostic);
|
|
@@ -522,13 +522,15 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
522
522
|
const shouldRunZeus = shouldCompileZeus(id);
|
|
523
523
|
const shouldStripTs = resolveTranspile(options.transpile, target) && isTypeScriptLike(id);
|
|
524
524
|
if (!shouldRunZeus && !shouldStripTs) return null;
|
|
525
|
-
|
|
525
|
+
const result = await transformZeus({
|
|
526
526
|
id,
|
|
527
527
|
code,
|
|
528
528
|
compiler: shouldRunZeus ? options.compiler : false,
|
|
529
529
|
sourcemap: true,
|
|
530
530
|
transpile: shouldStripTs
|
|
531
531
|
});
|
|
532
|
+
if (!result) return null;
|
|
533
|
+
return result;
|
|
532
534
|
},
|
|
533
535
|
async generateBundle(_, bundle) {
|
|
534
536
|
var _options$plugins2;
|
|
@@ -587,22 +589,15 @@ async function createManifest(root, include, exclude) {
|
|
|
587
589
|
version: 1,
|
|
588
590
|
components: []
|
|
589
591
|
},
|
|
590
|
-
diagnostics: []
|
|
592
|
+
diagnostics: [],
|
|
593
|
+
dependencies: []
|
|
591
594
|
};
|
|
592
|
-
return await (0, _zeus_js_component_analyzer.
|
|
595
|
+
return await (0, _zeus_js_component_analyzer.analyzeComponentsWithDependencies)({
|
|
593
596
|
root,
|
|
594
597
|
include,
|
|
595
598
|
exclude
|
|
596
599
|
});
|
|
597
600
|
}
|
|
598
|
-
async function collectWatchFiles(root, include, exclude) {
|
|
599
|
-
if (!include.length) return [];
|
|
600
|
-
return await (0, fast_glob.default)(include, {
|
|
601
|
-
cwd: root,
|
|
602
|
-
absolute: true,
|
|
603
|
-
ignore: exclude
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
601
|
function resolveTsLikeImport(id, importer, options) {
|
|
607
602
|
var _options$extensions;
|
|
608
603
|
if (!importer) return null;
|