@zeus-js/output-wc 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * output-wc v0.1.0-beta.4
2
+ * output-wc v0.1.0-beta.6
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
@@ -9,7 +9,7 @@ Object.defineProperties(exports, {
9
9
  });
10
10
  const ZEUS_OUTPUT_WC_CAPABILITIES = {
11
11
  packageName: "@zeus-js/output-wc",
12
- version: "0.1.0-beta.4",
12
+ version: "0.1.0-beta.6",
13
13
  output: {
14
14
  webComponent: true,
15
15
  customElements: true,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * output-wc v0.1.0-beta.4
2
+ * output-wc v0.1.0-beta.6
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
@@ -9,7 +9,7 @@ Object.defineProperties(exports, {
9
9
  });
10
10
  const ZEUS_OUTPUT_WC_CAPABILITIES = {
11
11
  packageName: "@zeus-js/output-wc",
12
- version: "0.1.0-beta.4",
12
+ version: "0.1.0-beta.6",
13
13
  output: {
14
14
  webComponent: true,
15
15
  customElements: true,
@@ -1,6 +1,6 @@
1
1
  const ZEUS_OUTPUT_WC_CAPABILITIES = {
2
2
  packageName: "@zeus-js/output-wc",
3
- version: "0.1.0-beta.4",
3
+ version: "0.1.0-beta.6",
4
4
  output: {
5
5
  webComponent: true,
6
6
  customElements: true,
@@ -1,6 +1,6 @@
1
1
  const ZEUS_OUTPUT_WC_CAPABILITIES = {
2
2
  packageName: "@zeus-js/output-wc",
3
- version: "0.1.0-beta.4",
3
+ version: "0.1.0-beta.6",
4
4
  output: {
5
5
  webComponent: true,
6
6
  customElements: true,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * output-wc v0.1.0-beta.4
2
+ * output-wc v0.1.0-beta.6
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
@@ -322,22 +322,60 @@ function generateLoader() {
322
322
  return `import { bootstrapLazy } from "@zeus-js/web-c-runtime";
323
323
  import { components } from "./components.manifest.js";
324
324
 
325
- let defined = false;
325
+ const componentsByTagName = new Map(
326
+ components.map(component => [component.tagName, component]),
327
+ );
326
328
 
327
- export function defineCustomElements() {
328
- if (defined) {
329
+ const definedTagsByRegistry = new WeakMap();
330
+
331
+ function resolveRegistry(options) {
332
+ return options.registry ??
333
+ (typeof customElements === "undefined" ? undefined : customElements);
334
+ }
335
+
336
+ function getDefinedTags(registry) {
337
+ let definedTags = definedTagsByRegistry.get(registry);
338
+
339
+ if (!definedTags) {
340
+ definedTags = new Set();
341
+ definedTagsByRegistry.set(registry, definedTags);
342
+ }
343
+
344
+ return definedTags;
345
+ }
346
+
347
+ export function defineCustomElement(tagName, options = {}) {
348
+ const registry = resolveRegistry(options);
349
+
350
+ if (!registry) {
329
351
  return;
330
352
  }
331
353
 
332
- if (typeof customElements === "undefined") {
354
+ const component = componentsByTagName.get(tagName);
355
+
356
+ if (!component) {
357
+ throw new Error(\`[zeus:web-c] Unknown custom element: <\${tagName}>.\`);
358
+ }
359
+
360
+ const definedTags = getDefinedTags(registry);
361
+
362
+ if (definedTags.has(tagName) || registry.get(tagName)) {
363
+ definedTags.add(tagName);
333
364
  return;
334
365
  }
335
366
 
336
- bootstrapLazy(components);
367
+ bootstrapLazy([component], { registry });
368
+
369
+ definedTags.add(tagName);
370
+ }
337
371
 
338
- defined = true;
372
+ export function defineCustomElements(options = {}) {
373
+ for (const component of components) {
374
+ defineCustomElement(component.tagName, options);
375
+ }
339
376
  }
340
377
 
378
+ export const defineLazyElement = defineCustomElement;
341
379
  export const defineLazyElements = defineCustomElements;
342
380
  `;
343
381
  }
@@ -351,7 +389,9 @@ export {};
351
389
  }
352
390
  function generateLazyIndex() {
353
391
  return `export {
392
+ defineCustomElement,
354
393
  defineCustomElements,
394
+ defineLazyElement,
355
395
  defineLazyElements,
356
396
  } from "./loader.js";
357
397
  `;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * output-wc v0.1.0-beta.4
2
+ * output-wc v0.1.0-beta.6
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
@@ -322,22 +322,60 @@ function generateLoader() {
322
322
  return `import { bootstrapLazy } from "@zeus-js/web-c-runtime";
323
323
  import { components } from "./components.manifest.js";
324
324
 
325
- let defined = false;
325
+ const componentsByTagName = new Map(
326
+ components.map(component => [component.tagName, component]),
327
+ );
326
328
 
327
- export function defineCustomElements() {
328
- if (defined) {
329
+ const definedTagsByRegistry = new WeakMap();
330
+
331
+ function resolveRegistry(options) {
332
+ return options.registry ??
333
+ (typeof customElements === "undefined" ? undefined : customElements);
334
+ }
335
+
336
+ function getDefinedTags(registry) {
337
+ let definedTags = definedTagsByRegistry.get(registry);
338
+
339
+ if (!definedTags) {
340
+ definedTags = new Set();
341
+ definedTagsByRegistry.set(registry, definedTags);
342
+ }
343
+
344
+ return definedTags;
345
+ }
346
+
347
+ export function defineCustomElement(tagName, options = {}) {
348
+ const registry = resolveRegistry(options);
349
+
350
+ if (!registry) {
329
351
  return;
330
352
  }
331
353
 
332
- if (typeof customElements === "undefined") {
354
+ const component = componentsByTagName.get(tagName);
355
+
356
+ if (!component) {
357
+ throw new Error(\`[zeus:web-c] Unknown custom element: <\${tagName}>.\`);
358
+ }
359
+
360
+ const definedTags = getDefinedTags(registry);
361
+
362
+ if (definedTags.has(tagName) || registry.get(tagName)) {
363
+ definedTags.add(tagName);
333
364
  return;
334
365
  }
335
366
 
336
- bootstrapLazy(components);
367
+ bootstrapLazy([component], { registry });
368
+
369
+ definedTags.add(tagName);
370
+ }
337
371
 
338
- defined = true;
372
+ export function defineCustomElements(options = {}) {
373
+ for (const component of components) {
374
+ defineCustomElement(component.tagName, options);
375
+ }
339
376
  }
340
377
 
378
+ export const defineLazyElement = defineCustomElement;
341
379
  export const defineLazyElements = defineCustomElements;
342
380
  `;
343
381
  }
@@ -351,7 +389,9 @@ export {};
351
389
  }
352
390
  function generateLazyIndex() {
353
391
  return `export {
392
+ defineCustomElement,
354
393
  defineCustomElements,
394
+ defineLazyElement,
355
395
  defineLazyElements,
356
396
  } from "./loader.js";
357
397
  `;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * output-wc v0.1.0-beta.4
2
+ * output-wc v0.1.0-beta.6
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
@@ -295,22 +295,60 @@ function generateLoader() {
295
295
  return `import { bootstrapLazy } from "@zeus-js/web-c-runtime";
296
296
  import { components } from "./components.manifest.js";
297
297
 
298
- let defined = false;
298
+ const componentsByTagName = new Map(
299
+ components.map(component => [component.tagName, component]),
300
+ );
299
301
 
300
- export function defineCustomElements() {
301
- if (defined) {
302
+ const definedTagsByRegistry = new WeakMap();
303
+
304
+ function resolveRegistry(options) {
305
+ return options.registry ??
306
+ (typeof customElements === "undefined" ? undefined : customElements);
307
+ }
308
+
309
+ function getDefinedTags(registry) {
310
+ let definedTags = definedTagsByRegistry.get(registry);
311
+
312
+ if (!definedTags) {
313
+ definedTags = new Set();
314
+ definedTagsByRegistry.set(registry, definedTags);
315
+ }
316
+
317
+ return definedTags;
318
+ }
319
+
320
+ export function defineCustomElement(tagName, options = {}) {
321
+ const registry = resolveRegistry(options);
322
+
323
+ if (!registry) {
302
324
  return;
303
325
  }
304
326
 
305
- if (typeof customElements === "undefined") {
327
+ const component = componentsByTagName.get(tagName);
328
+
329
+ if (!component) {
330
+ throw new Error(\`[zeus:web-c] Unknown custom element: <\${tagName}>.\`);
331
+ }
332
+
333
+ const definedTags = getDefinedTags(registry);
334
+
335
+ if (definedTags.has(tagName) || registry.get(tagName)) {
336
+ definedTags.add(tagName);
306
337
  return;
307
338
  }
308
339
 
309
- bootstrapLazy(components);
340
+ bootstrapLazy([component], { registry });
341
+
342
+ definedTags.add(tagName);
343
+ }
310
344
 
311
- defined = true;
345
+ export function defineCustomElements(options = {}) {
346
+ for (const component of components) {
347
+ defineCustomElement(component.tagName, options);
348
+ }
312
349
  }
313
350
 
351
+ export const defineLazyElement = defineCustomElement;
314
352
  export const defineLazyElements = defineCustomElements;
315
353
  `;
316
354
  }
@@ -324,7 +362,9 @@ export {};
324
362
  }
325
363
  function generateLazyIndex() {
326
364
  return `export {
365
+ defineCustomElement,
327
366
  defineCustomElements,
367
+ defineLazyElement,
328
368
  defineLazyElements,
329
369
  } from "./loader.js";
330
370
  `;
package/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "@zeus-js/output-wc",
3
- "version": "0.1.0-beta.4",
4
- "description": "Zeus Web Component output plugin",
5
3
  "type": "module",
6
- "main": "index.js",
7
- "module": "dist/output-wc.esm-bundler.js",
8
- "types": "dist/output-wc.d.ts",
9
- "files": [
10
- "index.js",
11
- "dist"
12
- ],
4
+ "version": "0.1.0-beta.6",
5
+ "description": "Zeus Web Component output plugin",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/baicie/zeus.git",
10
+ "directory": "packages/web-c/output-wc"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "provenance": true
15
+ },
16
+ "sideEffects": false,
13
17
  "exports": {
14
18
  ".": {
15
19
  "types": "./dist/output-wc.d.ts",
@@ -33,11 +37,26 @@
33
37
  }
34
38
  }
35
39
  },
36
- "sideEffects": false,
37
- "repository": {
38
- "type": "git",
39
- "url": "https://github.com/baicie/zeus"
40
+ "files": [
41
+ "index.js",
42
+ "dist"
43
+ ],
44
+ "peerDependencies": {
45
+ "rollup": "^4.0.0"
40
46
  },
47
+ "peerDependenciesMeta": {
48
+ "rollup": {
49
+ "optional": true
50
+ }
51
+ },
52
+ "dependencies": {
53
+ "@zeus-js/bundler-plugin": "0.1.0-beta.6",
54
+ "@zeus-js/web-c-runtime": "0.1.0-beta.6",
55
+ "@zeus-js/component-dts": "0.1.0-beta.6",
56
+ "@zeus-js/component-analyzer": "0.1.0-beta.6",
57
+ "@zeus-js/runtime-dom": "0.1.0-beta.6"
58
+ },
59
+ "author": "Baicie",
41
60
  "buildOptions": {
42
61
  "name": "ZeusOutputWC",
43
62
  "formats": [
@@ -51,26 +70,12 @@
51
70
  }
52
71
  ]
53
72
  },
54
- "dependencies": {
55
- "@zeus-js/bundler-plugin": "0.1.0-beta.4",
56
- "@zeus-js/component-analyzer": "0.1.0-beta.4",
57
- "@zeus-js/runtime-dom": "0.1.0-beta.4",
58
- "@zeus-js/component-dts": "0.1.0-beta.4",
59
- "@zeus-js/web-c-runtime": "0.2.0"
60
- },
61
- "peerDependencies": {
62
- "rollup": "^4.0.0"
63
- },
64
- "peerDependenciesMeta": {
65
- "rollup": {
66
- "optional": true
67
- }
68
- },
69
73
  "keywords": [
70
74
  "zeus",
71
75
  "web-components",
72
76
  "custom-elements"
73
77
  ],
74
- "author": "Baicie",
75
- "license": "MIT"
78
+ "main": "index.js",
79
+ "module": "dist/output-wc.esm-bundler.js",
80
+ "types": "dist/output-wc.d.ts"
76
81
  }