@qwik-custom-elements/adapter-stencil 1.0.0 → 1.0.2
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/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.qwik.cjs +7 -7
- package/dist/index.qwik.mjs +53 -46
- package/dist/q-manifest.json +4 -4
- package/package.json +39 -3
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export declare const metadata: {
|
|
|
4
4
|
supportsSsrProbe: boolean;
|
|
5
5
|
ssrRuntimeSubpath: string;
|
|
6
6
|
};
|
|
7
|
+
export declare function buildMissingCemHint({ packageRoot, }: {
|
|
8
|
+
packageRoot: string;
|
|
9
|
+
}): string | null;
|
|
7
10
|
interface ValidateProjectInput {
|
|
8
11
|
projectId?: string;
|
|
9
12
|
cwd?: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.qwik.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("node:fs"),_=require("node:path"),P={adapterId:"stencil",supportedSourceTypes:["CEM","PACKAGE_NAME"],supportsSsrProbe:!0,ssrRuntimeSubpath:"./ssr"};function w({packageRoot:e}){const t=_.join(e,"dist","collection","collection-manifest.json");return N.existsSync(t)?" This looks like a Stencil package. To fix this, ask the library author to add the `docs-custom-elements-manifest` output target to their `stencil.config.ts`: `{ type: 'docs-custom-elements-manifest', file: 'custom-elements.json' }`. Alternatively, set source.cemPath to the path of a manually generated CEM file.":null}function T({source:e,adapterOptions:t}){const n=S(t?.runtime)?t.runtime:void 0,r=y(n,"loaderImport","QCE_STENCIL_RUNTIME_LOADER_OVERRIDE_INVALID",`Stencil ${e.type} projects must provide a non-empty adapterOptions.runtime.loaderImport override when the override is set.`);if(y(n,"hydrateImport","QCE_STENCIL_RUNTIME_HYDRATE_OVERRIDE_INVALID",`Stencil ${e.type} projects must provide a non-empty adapterOptions.runtime.hydrateImport override when the override is set.`),e.type==="CEM"&&r==null)throw g("QCE_STENCIL_RUNTIME_LOADER_REQUIRED","Stencil CEM projects must provide adapterOptions.runtime.loaderImport.")}function L({projectId:e,runtimeResolution:t,source:n,adapterOptions:r}){const o=S(r?.runtime)?r.runtime:void 0,s=y(o,"loaderImport","QCE_STENCIL_RUNTIME_LOADER_OVERRIDE_INVALID",`Stencil ${n.type} projects must provide a non-empty adapterOptions.runtime.loaderImport override when the override is set.`),a=y(o,"hydrateImport","QCE_STENCIL_RUNTIME_HYDRATE_OVERRIDE_INVALID",`Stencil ${n.type} projects must provide a non-empty adapterOptions.runtime.hydrateImport override when the override is set.`);if(n.type==="CEM"){if(s==null)throw g("QCE_STENCIL_RUNTIME_LOADER_REQUIRED","Stencil CEM projects must provide adapterOptions.runtime.loaderImport.");return{loaderImport:s,hydrateImport:a}}const c=B(n.packageName,t),l=z({projectId:e,packageName:n.packageName,packageRoot:c,runtimeResolution:t,specifier:s??`${n.packageName}/loader`,field:"loader"}),p=[],m=H({packageName:n.packageName,packageRoot:c,runtimeResolution:t,specifier:a??`${n.packageName}/hydrate`,field:"hydrate",observedErrorCodes:p}),d={loaderImport:l};return m!=null&&(d.hydrateImport=m),p.length===0?d:{runtimeImports:d,observedErrorCodes:p,clientOnlyMode:!0}}async function b({runtimeImports:e}={}){if(!h(e?.loaderImport))return{available:!1};if(!h(e?.hydrateImport))return{available:!1};try{return{available:typeof(await import(e.hydrateImport)).renderToString=="function"}}catch{return{available:!1}}}async function O({componentDefinitions:e,runtimeImports:t}){if(!h(t?.hydrateImport))return e;let n;try{const o=await import(t.hydrateImport);typeof o.renderToString=="function"&&(n=o.renderToString)}catch{}if(n==null)return e;const r=[];for(const o of e){const s=await j(n,o.tagName),a=new Set(o.slots.map(l=>l.name)),c=s.filter(l=>!a.has(l)).map(l=>({name:l}));r.push({...o,slots:[...o.slots,...c]})}return r}async function j(e,t){try{const n=await e(`<${t}></${t}>`);return A(n.html??"")}catch{return[]}}function A(e){const t=/<!--s\.(?:\d+\.){4}(.*?)-->/g,n=[];for(const r of e.matchAll(t)){const o=r[1];o.length>0&&!n.includes(o)&&n.push(o)}return n}function M({projectId:e,libraryName:t,componentDefinitions:n,runtimeImports:r,ssrAvailable:o}){const s=typeof r?.loaderImport=="string"&&r.loaderImport.trim()!==""?r.loaderImport:void 0;if(s==null)return[];const a=typeof r?.hydrateImport=="string"&&r.hydrateImport.trim()!==""?r.hydrateImport:void 0,c=a!=null,l=(n??[]).map(m=>m.tagName),p=[{relativePath:"index.ts",content:Q(e,l)},{relativePath:"runtime.ts",content:U(e,c)},{relativePath:"runtime-csr.generated.ts",content:x(e,s,t)}];a!=null&&p.push({relativePath:"runtime-ssr.generated.ts",content:D(e,a,t)});for(const m of n??[])p.push({relativePath:`${m.tagName}.tsx`,content:q(e,m,c,t)});return p}function S(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function h(e){return typeof e=="string"&&e.trim()!==""}function x(e,t,n){const r=f(n,"CSR","GeneratedStencilCSRComponent");return[`// Generated by @qwik-custom-elements/core. Project: ${e??"unknown"}.`,"// Do not edit this file directly. Use a manual extension layer.","","import { $ } from '@builder.io/qwik';","import { createStencilCSRComponent, createStencilClientSetup } from '@qwik-custom-elements/adapter-stencil/client';",`import { defineCustomElements as runtimeDefineCustomElements } from '${t}';`,"","export const defineCustomElements = async (): Promise<void> => {"," await Promise.resolve(runtimeDefineCustomElements());","};","","export const defineCustomElementsQrl = $(defineCustomElements);","export const useStencilClientSetup ="," createStencilClientSetup(defineCustomElementsQrl);",`export const ${r} = createStencilCSRComponent();`,""].join(`
|
|
2
|
+
`)}function Q(e,t){const n=t.map(r=>`export { ${E(r)} } from './${r}';`);return[`// Generated by @qwik-custom-elements/core. Project: ${e??"unknown"}.`,"// Do not edit this file directly. Use a manual extension layer.","",`export const generatedComponentTags = ${JSON.stringify(t)} as const;`,...n,""].join(`
|
|
3
|
+
`)}function U(e,t){const n=["export * from './runtime-csr.generated';"];return t&&n.push("export * from './runtime-ssr.generated';"),[`// Generated by @qwik-custom-elements/core. Project: ${e??"unknown"}.`,"// Do not edit this file directly. Use a manual extension layer.","",...n,""].join(`
|
|
4
|
+
`)}function D(e,t,n){const r=f(n,"SSR","GeneratedStencilComponent");return[`// Generated by @qwik-custom-elements/core. Project: ${e??"unknown"}.`,"// Do not edit this file directly. Use a manual extension layer.","","import { $ } from '@builder.io/qwik';","import {"," createStencilSSRBridgeComponent,"," type StencilRenderToString,","} from '@qwik-custom-elements/adapter-stencil/ssr';","",`const hydrateModuleId = '${t}';`,"","export const renderToString: StencilRenderToString = async (input, options) => {"," const { renderToString: runtimeRenderToString } = await import("," // Variable indirection + @vite-ignore: prevents Vite from bundling the Node.js-only hydrate module into the client bundle."," /* @vite-ignore */ hydrateModuleId"," );"," return runtimeRenderToString(input, options);","};","","export const generatedStencilRenderToStringQrl = $(renderToString);",`export const ${r} = createStencilSSRBridgeComponent(`," generatedStencilRenderToStringQrl,",");",""].join(`
|
|
5
|
+
`)}function q(e,t,n,r){const o=E(t.tagName),s=`${o}Props`,a=n?f(r,"SSR","GeneratedStencilComponent"):f(r,"CSR","GeneratedStencilCSRComponent"),c=[" <Slot />",...t.slots.map(i=>` <span q:slot=${JSON.stringify(i.name)} style={{ display: 'contents' }}>
|
|
6
6
|
<Slot name=${JSON.stringify(i.name)} />
|
|
7
|
-
</span>`)],l=t.slots.length>0?JSON.stringify(t.slots.map(i=>i.name)):"undefined",p=t.props.map(i=>{const I=
|
|
8
|
-
`)}function E(e){return`Qwik${e.split("-").filter(r=>r.length>0).map(r=>`${r.charAt(0).toUpperCase()}${r.slice(1)}`).join("")}`}function
|
|
7
|
+
</span>`)],l=t.slots.length>0?JSON.stringify(t.slots.map(i=>i.name)):"undefined",p=t.props.map(i=>{const I=G(i.name)?i.name:`'${i.name}'`,k=i.required?"":"?";return` ${I}${k}: ${i.type};`}),m=t.events.map(i=>` ${u(i.name)}?: QRL<(event: ${i.type}) => void>;`);p.push(...m," [key: string]: unknown;");const d=["import { Slot, component$ } from '@builder.io/qwik';"];t.events.length>0&&d.push("import type { QRL } from '@builder.io/qwik';"),d.push(`import { ${a} } from './runtime';`);const R=[" const isEventBindingKey = (key: string) =>"," /^on[A-Z].*\\$$/.test(key) || key.includes(':');"," const eventProps: Record<string, unknown> = {};"," const elementProps: Record<string, unknown> = {};",""," for (const [key, value] of Object.entries(props as Record<string, unknown>)) {"," if (key === 'children') {"," continue;"," }",""," if (isEventBindingKey(key)) {"," eventProps[key] = value;"," continue;"," }",""," elementProps[key] = value;"," }"],$=t.events.length>0?["",` const mappedEventPropKeys = new Set(${JSON.stringify(t.events.map(i=>u(i.name)))});`," const passthroughEventProps = Object.fromEntries("," Object.entries(eventProps).filter("," ([key]) => !mappedEventPropKeys.has(key),"," ),"," );",""," const events: Record<string, QRL<(...args: any[]) => void>> = {};",...t.events.map(i=>` if (props.${u(i.name)}) { events['${i.name}'] = props.${u(i.name)}; }`)," const mappedEvents = Object.keys(events).length > 0 ? events : undefined;"]:[""," const passthroughEventProps = eventProps;"," const mappedEvents = undefined;"],C=[...R,...$,""," return (",` <${a}`,` tagName=${JSON.stringify(t.tagName)}`," props={elementProps}"," events={mappedEvents}",` slots={${l}}`," {...passthroughEventProps}"," >",...c,` </${a}>`," );"];return[`// Generated by @qwik-custom-elements/core. Project: ${e??"unknown"}.`,"// Do not edit this file directly. Use a manual extension layer.","",...d,"",`export interface ${s} {`,...p,"}","",`export const ${o} = component$<${s}>((props) => {`,...C,"});",""].join(`
|
|
8
|
+
`)}function E(e){return`Qwik${e.split("-").filter(r=>r.length>0).map(r=>`${r.charAt(0).toUpperCase()}${r.slice(1)}`).join("")}`}function V(e){return e.split(/[-_]/).filter(t=>t.length>0).map(t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`).join("")}function f(e,t,n){return!e||e.trim().length===0?n:`${V(e)}${t}BridgeComponent`}function G(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function u(e){return`on${e.split(/[^A-Za-z0-9]+/).filter(n=>n.length>0).map(n=>`${n.charAt(0).toUpperCase()}${n.slice(1)}`).join("")}$`}function B(e,t){return t?.resolveSourcePackageRoot?.(e??"")}function z(e){const{projectId:t,packageName:n,packageRoot:r,runtimeResolution:o,specifier:s,field:a}=e;try{return o?.resolveImportSpecifier?.(s,r),s}catch(c){throw g(v(a),J(t,`Could not resolve Stencil ${a} runtime import "${s}" for source package "${n}": ${K(c)}`))}}function H(e){const{packageRoot:t,runtimeResolution:n,specifier:r,field:o,observedErrorCodes:s}=e;try{return n?.resolveImportSpecifier?.(r,t),r}catch{s.push(v(o));return}}function v(e){return e==="loader"?"QCE_STENCIL_RUNTIME_LOADER_RESOLVE_FAILED":"QCE_STENCIL_RUNTIME_HYDRATE_RESOLVE_FAILED"}function J(e,t){return e==null?t:`Project "${e}": ${t}`}function K(e){return e instanceof Error?e.message:String(e)}function y(e,t,n,r){if(e==null||!(t in e))return;const o=e[t];if(typeof o=="string"&&o.trim()!=="")return o;throw g(n,r)}function g(e,t){return Object.assign(new Error(t),{code:e})}exports.augmentComponentDefinitions=O;exports.buildMissingCemHint=w;exports.createGeneratedOutput=M;exports.metadata=P;exports.probeSSR=b;exports.resolveRuntimeImports=L;exports.validateProject=T;
|
package/dist/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { existsSync as N } from "node:fs";
|
|
2
|
+
import _ from "node:path";
|
|
3
|
+
const B = {
|
|
2
4
|
adapterId: "stencil",
|
|
3
5
|
supportedSourceTypes: [
|
|
4
6
|
"CEM",
|
|
@@ -7,13 +9,17 @@ const D = {
|
|
|
7
9
|
supportsSsrProbe: !0,
|
|
8
10
|
ssrRuntimeSubpath: "./ssr"
|
|
9
11
|
};
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
+
function z({ packageRoot: e }) {
|
|
13
|
+
const t = _.join(e, "dist", "collection", "collection-manifest.json");
|
|
14
|
+
return N(t) ? " This looks like a Stencil package. To fix this, ask the library author to add the `docs-custom-elements-manifest` output target to their `stencil.config.ts`: `{ type: 'docs-custom-elements-manifest', file: 'custom-elements.json' }`. Alternatively, set source.cemPath to the path of a manually generated CEM file." : null;
|
|
15
|
+
}
|
|
16
|
+
function H({ source: e, adapterOptions: t }) {
|
|
17
|
+
const n = S(t?.runtime) ? t.runtime : void 0, r = y(n, "loaderImport", "QCE_STENCIL_RUNTIME_LOADER_OVERRIDE_INVALID", `Stencil ${e.type} projects must provide a non-empty adapterOptions.runtime.loaderImport override when the override is set.`);
|
|
12
18
|
if (y(n, "hydrateImport", "QCE_STENCIL_RUNTIME_HYDRATE_OVERRIDE_INVALID", `Stencil ${e.type} projects must provide a non-empty adapterOptions.runtime.hydrateImport override when the override is set.`), e.type === "CEM" && r == null)
|
|
13
19
|
throw g("QCE_STENCIL_RUNTIME_LOADER_REQUIRED", "Stencil CEM projects must provide adapterOptions.runtime.loaderImport.");
|
|
14
20
|
}
|
|
15
|
-
function
|
|
16
|
-
const o =
|
|
21
|
+
function J({ projectId: e, runtimeResolution: t, source: n, adapterOptions: r }) {
|
|
22
|
+
const o = S(r?.runtime) ? r.runtime : void 0, s = y(o, "loaderImport", "QCE_STENCIL_RUNTIME_LOADER_OVERRIDE_INVALID", `Stencil ${n.type} projects must provide a non-empty adapterOptions.runtime.loaderImport override when the override is set.`), a = y(o, "hydrateImport", "QCE_STENCIL_RUNTIME_HYDRATE_OVERRIDE_INVALID", `Stencil ${n.type} projects must provide a non-empty adapterOptions.runtime.hydrateImport override when the override is set.`);
|
|
17
23
|
if (n.type === "CEM") {
|
|
18
24
|
if (s == null) throw g("QCE_STENCIL_RUNTIME_LOADER_REQUIRED", "Stencil CEM projects must provide adapterOptions.runtime.loaderImport.");
|
|
19
25
|
return {
|
|
@@ -21,14 +27,14 @@ function V({ projectId: e, runtimeResolution: t, source: n, adapterOptions: r })
|
|
|
21
27
|
hydrateImport: a
|
|
22
28
|
};
|
|
23
29
|
}
|
|
24
|
-
const c =
|
|
30
|
+
const c = M(n.packageName, t), l = Q({
|
|
25
31
|
projectId: e,
|
|
26
32
|
packageName: n.packageName,
|
|
27
33
|
packageRoot: c,
|
|
28
34
|
runtimeResolution: t,
|
|
29
35
|
specifier: s ?? `${n.packageName}/loader`,
|
|
30
36
|
field: "loader"
|
|
31
|
-
}), p = [], m =
|
|
37
|
+
}), p = [], m = U({
|
|
32
38
|
packageName: n.packageName,
|
|
33
39
|
packageRoot: c,
|
|
34
40
|
runtimeResolution: t,
|
|
@@ -44,11 +50,11 @@ function V({ projectId: e, runtimeResolution: t, source: n, adapterOptions: r })
|
|
|
44
50
|
clientOnlyMode: !0
|
|
45
51
|
};
|
|
46
52
|
}
|
|
47
|
-
async function
|
|
48
|
-
if (!
|
|
53
|
+
async function K({ runtimeImports: e } = {}) {
|
|
54
|
+
if (!h(e?.loaderImport)) return {
|
|
49
55
|
available: !1
|
|
50
56
|
};
|
|
51
|
-
if (!
|
|
57
|
+
if (!h(e?.hydrateImport)) return {
|
|
52
58
|
available: !1
|
|
53
59
|
};
|
|
54
60
|
try {
|
|
@@ -64,8 +70,8 @@ async function G({ runtimeImports: e } = {}) {
|
|
|
64
70
|
};
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
|
-
async function
|
|
68
|
-
if (!
|
|
73
|
+
async function Z({ componentDefinitions: e, runtimeImports: t }) {
|
|
74
|
+
if (!h(t?.hydrateImport)) return e;
|
|
69
75
|
let n;
|
|
70
76
|
try {
|
|
71
77
|
const o = await import(
|
|
@@ -78,7 +84,7 @@ async function B({ componentDefinitions: e, runtimeImports: t }) {
|
|
|
78
84
|
if (n == null) return e;
|
|
79
85
|
const r = [];
|
|
80
86
|
for (const o of e) {
|
|
81
|
-
const s = await
|
|
87
|
+
const s = await w(n, o.tagName), a = new Set(o.slots.map((l) => l.name)), c = s.filter((l) => !a.has(l)).map((l) => ({
|
|
82
88
|
name: l
|
|
83
89
|
}));
|
|
84
90
|
r.push({
|
|
@@ -91,15 +97,15 @@ async function B({ componentDefinitions: e, runtimeImports: t }) {
|
|
|
91
97
|
}
|
|
92
98
|
return r;
|
|
93
99
|
}
|
|
94
|
-
async function
|
|
100
|
+
async function w(e, t) {
|
|
95
101
|
try {
|
|
96
102
|
const n = await e(`<${t}></${t}>`);
|
|
97
|
-
return
|
|
103
|
+
return P(n.html ?? "");
|
|
98
104
|
} catch {
|
|
99
105
|
return [];
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
|
-
function
|
|
108
|
+
function P(e) {
|
|
103
109
|
const t = /<!--s\.(?:\d+\.){4}(.*?)-->/g, n = [];
|
|
104
110
|
for (const r of e.matchAll(t)) {
|
|
105
111
|
const o = r[1];
|
|
@@ -107,40 +113,40 @@ function _(e) {
|
|
|
107
113
|
}
|
|
108
114
|
return n;
|
|
109
115
|
}
|
|
110
|
-
function
|
|
116
|
+
function F({ projectId: e, libraryName: t, componentDefinitions: n, runtimeImports: r, ssrAvailable: o }) {
|
|
111
117
|
const s = typeof r?.loaderImport == "string" && r.loaderImport.trim() !== "" ? r.loaderImport : void 0;
|
|
112
118
|
if (s == null) return [];
|
|
113
119
|
const a = typeof r?.hydrateImport == "string" && r.hydrateImport.trim() !== "" ? r.hydrateImport : void 0, c = a != null, l = (n ?? []).map((m) => m.tagName), p = [
|
|
114
120
|
{
|
|
115
121
|
relativePath: "index.ts",
|
|
116
|
-
content:
|
|
122
|
+
content: L(e, l)
|
|
117
123
|
},
|
|
118
124
|
{
|
|
119
125
|
relativePath: "runtime.ts",
|
|
120
|
-
content:
|
|
126
|
+
content: A(e, c)
|
|
121
127
|
},
|
|
122
128
|
{
|
|
123
129
|
relativePath: "runtime-csr.generated.ts",
|
|
124
|
-
content:
|
|
130
|
+
content: T(e, s, t)
|
|
125
131
|
}
|
|
126
132
|
];
|
|
127
133
|
a != null && p.push({
|
|
128
134
|
relativePath: "runtime-ssr.generated.ts",
|
|
129
|
-
content:
|
|
135
|
+
content: O(e, a, t)
|
|
130
136
|
});
|
|
131
137
|
for (const m of n ?? []) p.push({
|
|
132
138
|
relativePath: `${m.tagName}.tsx`,
|
|
133
|
-
content:
|
|
139
|
+
content: b(e, m, c, t)
|
|
134
140
|
});
|
|
135
141
|
return p;
|
|
136
142
|
}
|
|
137
|
-
function
|
|
143
|
+
function S(e) {
|
|
138
144
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
139
145
|
}
|
|
140
|
-
function
|
|
146
|
+
function h(e) {
|
|
141
147
|
return typeof e == "string" && e.trim() !== "";
|
|
142
148
|
}
|
|
143
|
-
function
|
|
149
|
+
function T(e, t, n) {
|
|
144
150
|
const r = f(n, "CSR", "GeneratedStencilCSRComponent");
|
|
145
151
|
return [
|
|
146
152
|
`// Generated by @qwik-custom-elements/core. Project: ${e ?? "unknown"}.`,
|
|
@@ -162,7 +168,7 @@ function w(e, t, n) {
|
|
|
162
168
|
].join(`
|
|
163
169
|
`);
|
|
164
170
|
}
|
|
165
|
-
function
|
|
171
|
+
function L(e, t) {
|
|
166
172
|
const n = t.map((r) => `export { ${E(r)} } from './${r}';`);
|
|
167
173
|
return [
|
|
168
174
|
`// Generated by @qwik-custom-elements/core. Project: ${e ?? "unknown"}.`,
|
|
@@ -174,7 +180,7 @@ function P(e, t) {
|
|
|
174
180
|
].join(`
|
|
175
181
|
`);
|
|
176
182
|
}
|
|
177
|
-
function
|
|
183
|
+
function A(e, t) {
|
|
178
184
|
const n = [
|
|
179
185
|
"export * from './runtime-csr.generated';"
|
|
180
186
|
];
|
|
@@ -187,7 +193,7 @@ function T(e, t) {
|
|
|
187
193
|
].join(`
|
|
188
194
|
`);
|
|
189
195
|
}
|
|
190
|
-
function
|
|
196
|
+
function O(e, t, n) {
|
|
191
197
|
const r = f(n, "SSR", "GeneratedStencilComponent");
|
|
192
198
|
return [
|
|
193
199
|
`// Generated by @qwik-custom-elements/core. Project: ${e ?? "unknown"}.`,
|
|
@@ -217,15 +223,15 @@ function L(e, t, n) {
|
|
|
217
223
|
].join(`
|
|
218
224
|
`);
|
|
219
225
|
}
|
|
220
|
-
function
|
|
226
|
+
function b(e, t, n, r) {
|
|
221
227
|
const o = E(t.tagName), s = `${o}Props`, a = n ? f(r, "SSR", "GeneratedStencilComponent") : f(r, "CSR", "GeneratedStencilCSRComponent"), c = [
|
|
222
228
|
" <Slot />",
|
|
223
229
|
...t.slots.map((i) => ` <span q:slot=${JSON.stringify(i.name)} style={{ display: 'contents' }}>
|
|
224
230
|
<Slot name=${JSON.stringify(i.name)} />
|
|
225
231
|
</span>`)
|
|
226
232
|
], l = t.slots.length > 0 ? JSON.stringify(t.slots.map((i) => i.name)) : "undefined", p = t.props.map((i) => {
|
|
227
|
-
const I =
|
|
228
|
-
return ` ${I}${
|
|
233
|
+
const I = x(i.name) ? i.name : `'${i.name}'`, k = i.required ? "" : "?";
|
|
234
|
+
return ` ${I}${k}: ${i.type};`;
|
|
229
235
|
}), m = t.events.map((i) => ` ${u(i.name)}?: QRL<(event: ${i.type}) => void>;`);
|
|
230
236
|
p.push(...m, " [key: string]: unknown;");
|
|
231
237
|
const d = [
|
|
@@ -302,30 +308,30 @@ function O(e, t, n, r) {
|
|
|
302
308
|
function E(e) {
|
|
303
309
|
return `Qwik${e.split("-").filter((r) => r.length > 0).map((r) => `${r.charAt(0).toUpperCase()}${r.slice(1)}`).join("")}`;
|
|
304
310
|
}
|
|
305
|
-
function
|
|
311
|
+
function j(e) {
|
|
306
312
|
return e.split(/[-_]/).filter((t) => t.length > 0).map((t) => `${t.charAt(0).toUpperCase()}${t.slice(1)}`).join("");
|
|
307
313
|
}
|
|
308
314
|
function f(e, t, n) {
|
|
309
|
-
return !e || e.trim().length === 0 ? n : `${
|
|
315
|
+
return !e || e.trim().length === 0 ? n : `${j(e)}${t}BridgeComponent`;
|
|
310
316
|
}
|
|
311
|
-
function
|
|
317
|
+
function x(e) {
|
|
312
318
|
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e);
|
|
313
319
|
}
|
|
314
320
|
function u(e) {
|
|
315
321
|
return `on${e.split(/[^A-Za-z0-9]+/).filter((n) => n.length > 0).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join("")}$`;
|
|
316
322
|
}
|
|
317
|
-
function
|
|
323
|
+
function M(e, t) {
|
|
318
324
|
return t?.resolveSourcePackageRoot?.(e ?? "");
|
|
319
325
|
}
|
|
320
|
-
function
|
|
326
|
+
function Q(e) {
|
|
321
327
|
const { projectId: t, packageName: n, packageRoot: r, runtimeResolution: o, specifier: s, field: a } = e;
|
|
322
328
|
try {
|
|
323
329
|
return o?.resolveImportSpecifier?.(s, r), s;
|
|
324
330
|
} catch (c) {
|
|
325
|
-
throw g(v(a),
|
|
331
|
+
throw g(v(a), D(t, `Could not resolve Stencil ${a} runtime import "${s}" for source package "${n}": ${q(c)}`));
|
|
326
332
|
}
|
|
327
333
|
}
|
|
328
|
-
function
|
|
334
|
+
function U(e) {
|
|
329
335
|
const { packageRoot: t, runtimeResolution: n, specifier: r, field: o, observedErrorCodes: s } = e;
|
|
330
336
|
try {
|
|
331
337
|
return n?.resolveImportSpecifier?.(r, t), r;
|
|
@@ -337,10 +343,10 @@ function M(e) {
|
|
|
337
343
|
function v(e) {
|
|
338
344
|
return e === "loader" ? "QCE_STENCIL_RUNTIME_LOADER_RESOLVE_FAILED" : "QCE_STENCIL_RUNTIME_HYDRATE_RESOLVE_FAILED";
|
|
339
345
|
}
|
|
340
|
-
function
|
|
346
|
+
function D(e, t) {
|
|
341
347
|
return e == null ? t : `Project "${e}": ${t}`;
|
|
342
348
|
}
|
|
343
|
-
function
|
|
349
|
+
function q(e) {
|
|
344
350
|
return e instanceof Error ? e.message : String(e);
|
|
345
351
|
}
|
|
346
352
|
function y(e, t, n, r) {
|
|
@@ -355,10 +361,11 @@ function g(e, t) {
|
|
|
355
361
|
});
|
|
356
362
|
}
|
|
357
363
|
export {
|
|
358
|
-
|
|
359
|
-
z as
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
+
Z as augmentComponentDefinitions,
|
|
365
|
+
z as buildMissingCemHint,
|
|
366
|
+
F as createGeneratedOutput,
|
|
367
|
+
B as metadata,
|
|
368
|
+
K as probeSSR,
|
|
369
|
+
J as resolveRuntimeImports,
|
|
370
|
+
H as validateProject
|
|
364
371
|
};
|
package/dist/q-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1",
|
|
3
|
-
"manifestHash": "
|
|
3
|
+
"manifestHash": "mbgtg",
|
|
4
4
|
"options": {
|
|
5
5
|
"target": "client",
|
|
6
6
|
"buildMode": "production",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"interactivity": 0
|
|
74
74
|
},
|
|
75
75
|
"../index.qwik.cjs": {
|
|
76
|
-
"size":
|
|
77
|
-
"total":
|
|
76
|
+
"size": 10553,
|
|
77
|
+
"total": 10553,
|
|
78
78
|
"origins": [
|
|
79
79
|
"src/index.ts"
|
|
80
80
|
],
|
|
@@ -376,6 +376,6 @@
|
|
|
376
376
|
"rollup": "4.60.1",
|
|
377
377
|
"env": "node",
|
|
378
378
|
"os": "linux",
|
|
379
|
-
"node": "
|
|
379
|
+
"node": "24.16.0"
|
|
380
380
|
}
|
|
381
381
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwik-custom-elements/adapter-stencil",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.qwik.cjs",
|
|
6
6
|
"module": "./dist/index.qwik.mjs",
|
|
@@ -28,18 +28,54 @@
|
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@builder.io/qwik": "^1.19.2",
|
|
31
|
-
"@builder.io/qwik-city": "^1.19.2"
|
|
31
|
+
"@builder.io/qwik-city": "^1.19.2",
|
|
32
|
+
"@qwik-custom-elements/core": "^1.0.2"
|
|
33
|
+
},
|
|
34
|
+
"peerDependenciesMeta": {
|
|
35
|
+
"@qwik-custom-elements/core": {
|
|
36
|
+
"optional": true
|
|
37
|
+
}
|
|
32
38
|
},
|
|
33
39
|
"devDependencies": {
|
|
34
40
|
"@builder.io/qwik": "^1.19.2",
|
|
35
41
|
"@builder.io/qwik-city": "^1.19.2",
|
|
36
42
|
"typescript": "^5.9.3",
|
|
37
43
|
"vite": "^7.3.1",
|
|
38
|
-
"vitest": "^3.2.4"
|
|
44
|
+
"vitest": "^3.2.4",
|
|
45
|
+
"@qwik-custom-elements/core": "1.0.2"
|
|
39
46
|
},
|
|
40
47
|
"publishConfig": {
|
|
41
48
|
"access": "public"
|
|
42
49
|
},
|
|
50
|
+
"description": "Stencil adapter for @qwik-custom-elements — SSR via Stencil hydrate runtime",
|
|
51
|
+
"keywords": [
|
|
52
|
+
"qwik",
|
|
53
|
+
"web-components",
|
|
54
|
+
"custom-elements",
|
|
55
|
+
"ssr",
|
|
56
|
+
"server-side-rendering",
|
|
57
|
+
"wrapper",
|
|
58
|
+
"manifest",
|
|
59
|
+
"stencil",
|
|
60
|
+
"stenciljs",
|
|
61
|
+
"hydrate"
|
|
62
|
+
],
|
|
63
|
+
"author": "Dmitry A. Efimenko (https://github.com/DmitryEfimenko)",
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "https://github.com/DmitryEfimenko/qwik-custom-elements.git",
|
|
68
|
+
"directory": "packages/adapter-stencil"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/DmitryEfimenko/qwik-custom-elements#readme",
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/DmitryEfimenko/qwik-custom-elements/issues"
|
|
73
|
+
},
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": ">=20"
|
|
76
|
+
},
|
|
77
|
+
"funding": "https://github.com/sponsors/DmitryEfimenko",
|
|
78
|
+
"sideEffects": false,
|
|
43
79
|
"scripts": {
|
|
44
80
|
"build": "vite build && tsc -p tsconfig.json --emitDeclarationOnly",
|
|
45
81
|
"check-types": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|