@stacksjs/stx 0.2.174 → 0.2.176
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/a11y.d.ts +72 -2
- package/dist/a11y.js +25 -10
- package/dist/cli.js +1045 -930
- package/dist/client-script.js +1 -0
- package/dist/component-renderer.js +17 -0
- package/dist/craft.js +561 -453
- package/dist/includes.js +8 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/process.js +2 -1
- package/dist/props.d.ts +51 -8
- package/dist/pwa.js +512 -404
- package/dist/resolve-stx-targets.d.ts +49 -0
- package/dist/resolve-stx-targets.js +38 -0
- package/dist/runtime-globals.d.ts +24 -0
- package/dist/runtime-globals.js +16 -0
- package/dist/runtime-injection.d.ts +36 -0
- package/dist/runtime-injection.js +15 -0
- package/dist/server-bindings.js +3 -0
- package/dist/signal-processing.js +1 -1
- package/dist/signals.js +30 -27
- package/dist/ssg.d.ts +23 -0
- package/dist/ssg.js +509 -397
- package/dist/stx-virtual-ts.d.ts +27 -3
- package/dist/stx-virtual-ts.js +36 -0
- package/dist/typecheck.js +96 -62
- package/dist/types/config-types.d.ts +24 -0
- package/dist/utils.js +5 -4
- package/package.json +5 -5
package/dist/client-script.js
CHANGED
|
@@ -6,6 +6,7 @@ import { renderComponentWithSlot, userComponentFileExists } from "./utils.js";
|
|
|
6
6
|
import { createSafeFunction, isExpressionSafe, safeEvaluateObject } from "./safe-evaluator.js";
|
|
7
7
|
import { BOOLEAN_ATTRIBUTE_SENTINEL } from "./prop-sentinels.js";
|
|
8
8
|
import { COMPONENT_PASSTHROUGH_X_ATTRS } from "./runtime-globals.js";
|
|
9
|
+
import { stripCommentsAndLiterals } from "./strip-literals.js";
|
|
9
10
|
import fs from "node:fs";
|
|
10
11
|
import path from "node:path";
|
|
11
12
|
let builtinsRegistered = !1;
|
|
@@ -183,6 +184,18 @@ function parseComponentProps(rawProps, context, options) {
|
|
|
183
184
|
serverDynamic: {},
|
|
184
185
|
clientReactive: {},
|
|
185
186
|
events: {}
|
|
187
|
+
}, clientSignalNames = new Set(Array.isArray(context.__stx_client_signal_names) ? context.__stx_client_signal_names : []), referencesClientSignal = (expression) => {
|
|
188
|
+
if (clientSignalNames.size === 0)
|
|
189
|
+
return !1;
|
|
190
|
+
const code = stripCommentsAndLiterals(expression), leadingIdentifier = code.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];
|
|
191
|
+
if (leadingIdentifier && clientSignalNames.has(leadingIdentifier))
|
|
192
|
+
return !0;
|
|
193
|
+
for (const signalName of clientSignalNames) {
|
|
194
|
+
const escapedName = signalName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
195
|
+
if (new RegExp(`(?:^|[^\\w$.])${escapedName}\\s*\\(`).test(code))
|
|
196
|
+
return !0;
|
|
197
|
+
}
|
|
198
|
+
return !1;
|
|
186
199
|
}, ALPINE_PASSTHROUGH = new Set(COMPONENT_PASSTHROUGH_X_ATTRS), kebabToCamel = (key) => {
|
|
187
200
|
if (!key.includes("-") || key.startsWith("@") || key.startsWith(":") || key.startsWith("x-") || key.startsWith("__"))
|
|
188
201
|
return key;
|
|
@@ -212,6 +225,10 @@ function parseComponentProps(rawProps, context, options) {
|
|
|
212
225
|
resolved.clientReactive[propName] = expression;
|
|
213
226
|
continue;
|
|
214
227
|
}
|
|
228
|
+
if (referencesClientSignal(expression)) {
|
|
229
|
+
resolved.clientReactive[propName] = expression;
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
215
232
|
try {
|
|
216
233
|
if (!isExpressionSafe(expression)) {
|
|
217
234
|
if (options.debug)
|