@stacksjs/stx 0.2.107 → 0.2.108
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/cli.js +385 -385
- package/dist/expressions.js +1 -1
- package/dist/pwa.js +133 -133
- package/dist/ssg.js +142 -142
- package/dist/utils.d.ts +13 -0
- package/dist/utils.js +8 -1
- package/package.json +5 -5
package/dist/utils.d.ts
CHANGED
|
@@ -32,6 +32,19 @@ export declare function userComponentFileExists(componentPath: string, component
|
|
|
32
32
|
* Mirrors the stx-hydrate runtime triggers; `load` (eager) is handled separately.
|
|
33
33
|
*/
|
|
34
34
|
export declare function isHydrateTrigger(trigger: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Does this slot content carry template expressions?
|
|
37
|
+
*
|
|
38
|
+
* Slot content belongs to the caller, so `{{ ... }}` inside it names the
|
|
39
|
+
* caller's variables. When any are present the component has to be treated as
|
|
40
|
+
* signal-bearing, or the expression pipeline resolves them against the
|
|
41
|
+
* component's context (where they do not exist) and renders them as empty.
|
|
42
|
+
*
|
|
43
|
+
* `<script>` and `<style>` regions are ignored: a regex or a CSS rule can
|
|
44
|
+
* contain brace pairs that are not template expressions, and matching them
|
|
45
|
+
* would flag components that have no slot expressions at all.
|
|
46
|
+
*/
|
|
47
|
+
export declare function slotContentHasExpressions(slotContent: string): boolean;
|
|
35
48
|
export declare function renderComponentWithSlot(componentPath: string, props: Record<string, unknown>, slotContent: string, componentsDir: string, parentContext: Record<string, unknown>, parentFilePath: string, options: StxOptions, processedComponents?: Set<string> | undefined, dependencies: Set<string>): Promise<string>;
|
|
36
49
|
/**
|
|
37
50
|
* Check if a file exists
|
package/dist/utils.js
CHANGED
|
@@ -350,6 +350,12 @@ export async function userComponentFileExists(componentPath, componentsDir, pare
|
|
|
350
350
|
export function isHydrateTrigger(trigger) {
|
|
351
351
|
return trigger === "visible" || trigger === "idle" || trigger === "interaction" || trigger.startsWith("media:");
|
|
352
352
|
}
|
|
353
|
+
export function slotContentHasExpressions(slotContent) {
|
|
354
|
+
if (!slotContent)
|
|
355
|
+
return !1;
|
|
356
|
+
const withoutScripts = slotContent.replace(/<script[\s\S]*?<\/script>/gi, "").replace(/<style[\s\S]*?<\/style>/gi, "");
|
|
357
|
+
return /\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(withoutScripts);
|
|
358
|
+
}
|
|
353
359
|
export async function renderComponentWithSlot(componentPath, props, slotContent, componentsDir, parentContext, parentFilePath, options, processedComponents = new Set, dependencies) {
|
|
354
360
|
const { extractVariables } = await import("./variable-extractor.js"), components = processedComponents ?? new Set;
|
|
355
361
|
if (components.has(componentPath))
|
|
@@ -510,7 +516,8 @@ ${triedPaths.map((p) => ` - ${p}`).join(`
|
|
|
510
516
|
slot: slotContent,
|
|
511
517
|
$slots,
|
|
512
518
|
__processedComponents: branchComponents,
|
|
513
|
-
__sections: {}
|
|
519
|
+
__sections: {},
|
|
520
|
+
...slotContentHasExpressions(slotContent) && { __stx_force_signals: !0 }
|
|
514
521
|
};
|
|
515
522
|
applyDestructuredPropDefaults(componentContent, componentContext);
|
|
516
523
|
let workingContent = componentContent;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.108",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,16 +117,16 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@cwcss/crosswind": "^0.2.6",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
120
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/sanitizer": "0.2.108",
|
|
121
121
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
122
|
-
"bun-plugin-stx": "0.2.
|
|
122
|
+
"bun-plugin-stx": "0.2.108",
|
|
123
123
|
"bunfig": "^0.15.15",
|
|
124
|
-
"stx-router": "0.2.
|
|
124
|
+
"stx-router": "0.2.108",
|
|
125
125
|
"ts-broadcasting": "^0.0.9",
|
|
126
126
|
"ts-images": "^0.1.9",
|
|
127
127
|
"ts-syntax-highlighter": "^0.2.1"
|
|
128
128
|
},
|
|
129
129
|
"optionalDependencies": {
|
|
130
|
-
"@stacksjs/desktop": "0.2.
|
|
130
|
+
"@stacksjs/desktop": "0.2.108"
|
|
131
131
|
}
|
|
132
132
|
}
|