@zeus-js/bundler-plugin 0.1.0-beta.4 → 0.1.0-beta.6
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 +19 -17
- package/dist/bundler-plugin.cjs.prod.js +19 -17
- package/dist/bundler-plugin.esm-bundler.js +26 -24
- 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 +19 -17
- package/dist/rolldown.cjs.prod.js +19 -17
- package/dist/rolldown.js +26 -24
- package/dist/rolldown.prod.js +26 -24
- package/dist/rollup.cjs.js +19 -17
- package/dist/rollup.cjs.prod.js +19 -17
- package/dist/rollup.js +26 -24
- package/dist/rollup.prod.js +26 -24
- package/dist/vite.cjs.js +19 -17
- package/dist/vite.cjs.prod.js +19 -17
- package/dist/vite.js +24 -22
- package/dist/vite.prod.js +24 -22
- 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.6
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -41,8 +41,8 @@ picomatch = __toESM(picomatch, 1);
|
|
|
41
41
|
let node_fs_promises = require("node:fs/promises");
|
|
42
42
|
node_fs_promises = __toESM(node_fs_promises, 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
|
let node_module = require("node:module");
|
|
@@ -99,7 +99,7 @@ function resolveComponentExclude(exclude) {
|
|
|
99
99
|
}
|
|
100
100
|
function resolveTransformInclude(include, componentInclude) {
|
|
101
101
|
if (include === null || include === void 0 ? void 0 : include.length) return include;
|
|
102
|
-
return Array.from(new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
102
|
+
return Array.from(/* @__PURE__ */ new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
103
103
|
}
|
|
104
104
|
function resolveTransformExclude(exclude) {
|
|
105
105
|
return (exclude === null || exclude === void 0 ? void 0 : exclude.length) ? exclude : DEFAULT_TRANSFORM_EXCLUDE;
|
|
@@ -279,29 +279,29 @@ function normalizeTagName(tag, stripPrefix) {
|
|
|
279
279
|
//#endregion
|
|
280
280
|
//#region packages/web-c/bundler-plugin/src/transform.ts
|
|
281
281
|
async function transformZeus(options) {
|
|
282
|
-
var _compilerOptions$modu;
|
|
283
282
|
const { id, code, compiler, sourcemap = true, transpile = false } = options;
|
|
283
|
+
const filename = cleanUrl(id);
|
|
284
284
|
const isTs = isTypeScriptLike(id);
|
|
285
|
-
const isTsx = /\.[cm]?tsx$/.test(id.replace(/[?#].*$/, ""));
|
|
286
285
|
const shouldRunCompiler = compiler !== false;
|
|
287
286
|
const shouldStripTs = transpile && isTs;
|
|
288
287
|
if (!shouldRunCompiler && !shouldStripTs) return null;
|
|
289
288
|
const compilerOptions = compiler === false ? {} : compiler === void 0 ? {} : compiler;
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
plugins
|
|
289
|
+
const plugins = [];
|
|
290
|
+
if (shouldRunCompiler) {
|
|
291
|
+
var _compilerOptions$modu;
|
|
292
|
+
plugins.push([_zeus_js_compiler.default, {
|
|
294
293
|
moduleName: (_compilerOptions$modu = compilerOptions.moduleName) !== null && _compilerOptions$modu !== void 0 ? _compilerOptions$modu : "@zeus-js/runtime-dom",
|
|
295
294
|
generate: "dom",
|
|
296
295
|
hydratable: false,
|
|
297
296
|
delegateEvents: true,
|
|
298
297
|
...compilerOptions
|
|
299
|
-
}]
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
298
|
+
}]);
|
|
299
|
+
}
|
|
300
|
+
if (shouldStripTs) plugins.push([_babel_plugin_transform_typescript.default, {}]);
|
|
301
|
+
const result = await (0, _babel_core.transformAsync)(code, {
|
|
302
|
+
filename,
|
|
303
|
+
sourceMaps: sourcemap,
|
|
304
|
+
plugins,
|
|
305
305
|
parserOpts: {
|
|
306
306
|
sourceType: "module",
|
|
307
307
|
plugins: ["typescript", "jsx"]
|
|
@@ -524,13 +524,15 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
524
524
|
const shouldRunZeus = shouldCompileZeus(id);
|
|
525
525
|
const shouldStripTs = resolveTranspile(options.transpile, target) && isTypeScriptLike(id);
|
|
526
526
|
if (!shouldRunZeus && !shouldStripTs) return null;
|
|
527
|
-
|
|
527
|
+
const result = await transformZeus({
|
|
528
528
|
id,
|
|
529
529
|
code,
|
|
530
530
|
compiler: shouldRunZeus ? options.compiler : false,
|
|
531
531
|
sourcemap: true,
|
|
532
532
|
transpile: shouldStripTs
|
|
533
533
|
});
|
|
534
|
+
if (!result) return null;
|
|
535
|
+
return result;
|
|
534
536
|
},
|
|
535
537
|
async generateBundle(_, bundle) {
|
|
536
538
|
var _options$plugins2;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bundler-plugin v0.1.0-beta.
|
|
2
|
+
* bundler-plugin v0.1.0-beta.6
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -41,8 +41,8 @@ picomatch = __toESM(picomatch, 1);
|
|
|
41
41
|
let node_fs_promises = require("node:fs/promises");
|
|
42
42
|
node_fs_promises = __toESM(node_fs_promises, 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
|
let node_module = require("node:module");
|
|
@@ -99,7 +99,7 @@ function resolveComponentExclude(exclude) {
|
|
|
99
99
|
}
|
|
100
100
|
function resolveTransformInclude(include, componentInclude) {
|
|
101
101
|
if (include === null || include === void 0 ? void 0 : include.length) return include;
|
|
102
|
-
return Array.from(new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
102
|
+
return Array.from(/* @__PURE__ */ new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
103
103
|
}
|
|
104
104
|
function resolveTransformExclude(exclude) {
|
|
105
105
|
return (exclude === null || exclude === void 0 ? void 0 : exclude.length) ? exclude : DEFAULT_TRANSFORM_EXCLUDE;
|
|
@@ -279,29 +279,29 @@ function normalizeTagName(tag, stripPrefix) {
|
|
|
279
279
|
//#endregion
|
|
280
280
|
//#region packages/web-c/bundler-plugin/src/transform.ts
|
|
281
281
|
async function transformZeus(options) {
|
|
282
|
-
var _compilerOptions$modu;
|
|
283
282
|
const { id, code, compiler, sourcemap = true, transpile = false } = options;
|
|
283
|
+
const filename = cleanUrl(id);
|
|
284
284
|
const isTs = isTypeScriptLike(id);
|
|
285
|
-
const isTsx = /\.[cm]?tsx$/.test(id.replace(/[?#].*$/, ""));
|
|
286
285
|
const shouldRunCompiler = compiler !== false;
|
|
287
286
|
const shouldStripTs = transpile && isTs;
|
|
288
287
|
if (!shouldRunCompiler && !shouldStripTs) return null;
|
|
289
288
|
const compilerOptions = compiler === false ? {} : compiler === void 0 ? {} : compiler;
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
plugins
|
|
289
|
+
const plugins = [];
|
|
290
|
+
if (shouldRunCompiler) {
|
|
291
|
+
var _compilerOptions$modu;
|
|
292
|
+
plugins.push([_zeus_js_compiler.default, {
|
|
294
293
|
moduleName: (_compilerOptions$modu = compilerOptions.moduleName) !== null && _compilerOptions$modu !== void 0 ? _compilerOptions$modu : "@zeus-js/runtime-dom",
|
|
295
294
|
generate: "dom",
|
|
296
295
|
hydratable: false,
|
|
297
296
|
delegateEvents: true,
|
|
298
297
|
...compilerOptions
|
|
299
|
-
}]
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
298
|
+
}]);
|
|
299
|
+
}
|
|
300
|
+
if (shouldStripTs) plugins.push([_babel_plugin_transform_typescript.default, {}]);
|
|
301
|
+
const result = await (0, _babel_core.transformAsync)(code, {
|
|
302
|
+
filename,
|
|
303
|
+
sourceMaps: sourcemap,
|
|
304
|
+
plugins,
|
|
305
305
|
parserOpts: {
|
|
306
306
|
sourceType: "module",
|
|
307
307
|
plugins: ["typescript", "jsx"]
|
|
@@ -524,13 +524,15 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
524
524
|
const shouldRunZeus = shouldCompileZeus(id);
|
|
525
525
|
const shouldStripTs = resolveTranspile(options.transpile, target) && isTypeScriptLike(id);
|
|
526
526
|
if (!shouldRunZeus && !shouldStripTs) return null;
|
|
527
|
-
|
|
527
|
+
const result = await transformZeus({
|
|
528
528
|
id,
|
|
529
529
|
code,
|
|
530
530
|
compiler: shouldRunZeus ? options.compiler : false,
|
|
531
531
|
sourcemap: true,
|
|
532
532
|
transpile: shouldStripTs
|
|
533
533
|
});
|
|
534
|
+
if (!result) return null;
|
|
535
|
+
return result;
|
|
534
536
|
},
|
|
535
537
|
async generateBundle(_, bundle) {
|
|
536
538
|
var _options$plugins2;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bundler-plugin v0.1.0-beta.
|
|
2
|
+
* bundler-plugin v0.1.0-beta.6
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -10,7 +10,7 @@ import fg from "fast-glob";
|
|
|
10
10
|
import picomatch from "picomatch";
|
|
11
11
|
import fs$1 from "node:fs/promises";
|
|
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
|
import { createRequire } from "node:module";
|
|
16
16
|
import { mergeConfig } from "vite";
|
|
@@ -66,7 +66,7 @@ function resolveComponentExclude(exclude) {
|
|
|
66
66
|
}
|
|
67
67
|
function resolveTransformInclude(include, componentInclude) {
|
|
68
68
|
if (include === null || include === void 0 ? void 0 : include.length) return include;
|
|
69
|
-
return Array.from(new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
69
|
+
return Array.from(/* @__PURE__ */ new Set([...DEFAULT_TRANSFORM_INCLUDE, ...componentInclude]));
|
|
70
70
|
}
|
|
71
71
|
function resolveTransformExclude(exclude) {
|
|
72
72
|
return (exclude === null || exclude === void 0 ? void 0 : exclude.length) ? exclude : DEFAULT_TRANSFORM_EXCLUDE;
|
|
@@ -80,7 +80,7 @@ function hasErrorDiagnostics(diagnostics) {
|
|
|
80
80
|
return diagnostics.some((item) => item.level === "error");
|
|
81
81
|
}
|
|
82
82
|
//#endregion
|
|
83
|
-
//#region \0@oxc-project+runtime@0.
|
|
83
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/asyncToGenerator.js
|
|
84
84
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
85
85
|
try {
|
|
86
86
|
var i = n[a](c), u = i.value;
|
|
@@ -106,7 +106,7 @@ function _asyncToGenerator(n) {
|
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
|
-
//#region \0@oxc-project+runtime@0.
|
|
109
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
|
|
110
110
|
function _typeof(o) {
|
|
111
111
|
"@babel/helpers - typeof";
|
|
112
112
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -116,7 +116,7 @@ function _typeof(o) {
|
|
|
116
116
|
}, _typeof(o);
|
|
117
117
|
}
|
|
118
118
|
//#endregion
|
|
119
|
-
//#region \0@oxc-project+runtime@0.
|
|
119
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
|
|
120
120
|
function toPrimitive(t, r) {
|
|
121
121
|
if ("object" != _typeof(t) || !t) return t;
|
|
122
122
|
var e = t[Symbol.toPrimitive];
|
|
@@ -128,13 +128,13 @@ function toPrimitive(t, r) {
|
|
|
128
128
|
return ("string" === r ? String : Number)(t);
|
|
129
129
|
}
|
|
130
130
|
//#endregion
|
|
131
|
-
//#region \0@oxc-project+runtime@0.
|
|
131
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
|
|
132
132
|
function toPropertyKey(t) {
|
|
133
133
|
var i = toPrimitive(t, "string");
|
|
134
134
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
135
135
|
}
|
|
136
136
|
//#endregion
|
|
137
|
-
//#region \0@oxc-project+runtime@0.
|
|
137
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
|
|
138
138
|
function _defineProperty(e, r, t) {
|
|
139
139
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
140
140
|
value: t,
|
|
@@ -144,7 +144,7 @@ function _defineProperty(e, r, t) {
|
|
|
144
144
|
}) : e[r] = t, e;
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
|
-
//#region \0@oxc-project+runtime@0.
|
|
147
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/objectSpread2.js
|
|
148
148
|
function ownKeys(e, r) {
|
|
149
149
|
var t = Object.keys(e);
|
|
150
150
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -368,28 +368,28 @@ function transformZeus(_x) {
|
|
|
368
368
|
}
|
|
369
369
|
function _transformZeus() {
|
|
370
370
|
_transformZeus = _asyncToGenerator(function* (options) {
|
|
371
|
-
var _compilerOptions$modu;
|
|
372
371
|
const { id, code, compiler, sourcemap = true, transpile = false } = options;
|
|
372
|
+
const filename = cleanUrl(id);
|
|
373
373
|
const isTs = isTypeScriptLike(id);
|
|
374
|
-
const isTsx = /\.[cm]?tsx$/.test(id.replace(/[?#].*$/, ""));
|
|
375
374
|
const shouldRunCompiler = compiler !== false;
|
|
376
375
|
const shouldStripTs = transpile && isTs;
|
|
377
376
|
if (!shouldRunCompiler && !shouldStripTs) return null;
|
|
378
377
|
const compilerOptions = compiler === false ? {} : compiler === void 0 ? {} : compiler;
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
plugins
|
|
378
|
+
const plugins = [];
|
|
379
|
+
if (shouldRunCompiler) {
|
|
380
|
+
var _compilerOptions$modu;
|
|
381
|
+
plugins.push([zeusCompiler, _objectSpread2({
|
|
383
382
|
moduleName: (_compilerOptions$modu = compilerOptions.moduleName) !== null && _compilerOptions$modu !== void 0 ? _compilerOptions$modu : "@zeus-js/runtime-dom",
|
|
384
383
|
generate: "dom",
|
|
385
384
|
hydratable: false,
|
|
386
385
|
delegateEvents: true
|
|
387
|
-
}, compilerOptions)]
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
386
|
+
}, compilerOptions)]);
|
|
387
|
+
}
|
|
388
|
+
if (shouldStripTs) plugins.push([transformTypeScript, {}]);
|
|
389
|
+
const result = yield transformAsync(code, {
|
|
390
|
+
filename,
|
|
391
|
+
sourceMaps: sourcemap,
|
|
392
|
+
plugins,
|
|
393
393
|
parserOpts: {
|
|
394
394
|
sourceType: "module",
|
|
395
395
|
plugins: ["typescript", "jsx"]
|
|
@@ -612,13 +612,15 @@ function createZeusBundlerPlugin(options = {}, createOptions) {
|
|
|
612
612
|
const shouldRunZeus = shouldCompileZeus(id);
|
|
613
613
|
const shouldStripTs = resolveTranspile(options.transpile, target) && isTypeScriptLike(id);
|
|
614
614
|
if (!shouldRunZeus && !shouldStripTs) return null;
|
|
615
|
-
|
|
615
|
+
const result = yield transformZeus({
|
|
616
616
|
id,
|
|
617
617
|
code,
|
|
618
618
|
compiler: shouldRunZeus ? options.compiler : false,
|
|
619
619
|
sourcemap: true,
|
|
620
620
|
transpile: shouldStripTs
|
|
621
621
|
});
|
|
622
|
+
if (!result) return null;
|
|
623
|
+
return result;
|
|
622
624
|
})();
|
|
623
625
|
},
|
|
624
626
|
generateBundle(_, bundle) {
|
|
@@ -774,7 +776,7 @@ function resolveVirtualEntryImport(id, importer) {
|
|
|
774
776
|
return `${importer.slice(0, lastColon + 1)}entry:${tagName}`;
|
|
775
777
|
}
|
|
776
778
|
//#endregion
|
|
777
|
-
//#region \0@oxc-project+runtime@0.
|
|
779
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
778
780
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
779
781
|
if (null == r) return {};
|
|
780
782
|
var t = {};
|
|
@@ -785,7 +787,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
785
787
|
return t;
|
|
786
788
|
}
|
|
787
789
|
//#endregion
|
|
788
|
-
//#region \0@oxc-project+runtime@0.
|
|
790
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/objectWithoutProperties.js
|
|
789
791
|
function _objectWithoutProperties(e, t) {
|
|
790
792
|
if (null == e) return {};
|
|
791
793
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
package/dist/rolldown.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bundler-plugin v0.1.0-beta.
|
|
2
|
+
* bundler-plugin v0.1.0-beta.6
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -41,8 +41,8 @@ picomatch = __toESM(picomatch, 1);
|
|
|
41
41
|
let node_fs_promises = require("node:fs/promises");
|
|
42
42
|
node_fs_promises = __toESM(node_fs_promises, 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"]
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bundler-plugin v0.1.0-beta.
|
|
2
|
+
* bundler-plugin v0.1.0-beta.6
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -41,8 +41,8 @@ picomatch = __toESM(picomatch, 1);
|
|
|
41
41
|
let node_fs_promises = require("node:fs/promises");
|
|
42
42
|
node_fs_promises = __toESM(node_fs_promises, 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"]
|
|
@@ -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;
|