bun-plugin-stx 0.2.11 → 0.2.12
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.
|
@@ -846,7 +846,12 @@ else {
|
|
|
846
846
|
fragScripts.forEach(function(code){
|
|
847
847
|
console.log('[router] exec script len:', code.length, 'has __stx_setup:', code.indexOf('__stx_setup')>-1);
|
|
848
848
|
var ns=document.createElement('script');
|
|
849
|
-
|
|
849
|
+
// Wrap in block scope to prevent const/let collisions on re-navigation.
|
|
850
|
+
// Without this, navigating away and back throws "Identifier has already
|
|
851
|
+
// been declared" because the previous page's top-level const/let are
|
|
852
|
+
// still in the global scope.
|
|
853
|
+
var isAlreadyScoped=code.trimStart().charAt(0)==='('||code.trimStart().charAt(0)===';'||code.indexOf('window.stx.mount')>-1;
|
|
854
|
+
ns.textContent=isAlreadyScoped?code:'{'+code+'}';
|
|
850
855
|
ns.setAttribute('data-stx-page','');
|
|
851
856
|
document.body.appendChild(ns);
|
|
852
857
|
});
|
|
@@ -1055,7 +1060,11 @@ else {
|
|
|
1055
1060
|
if(hasImport){
|
|
1056
1061
|
ns.type='module';
|
|
1057
1062
|
}
|
|
1058
|
-
|
|
1063
|
+
// Wrap in block scope to prevent const/let collisions on re-navigation.
|
|
1064
|
+
// Top-level const/let in <script> tags are global-scoped in browsers
|
|
1065
|
+
// and throw "Identifier has already been declared" on re-execution.
|
|
1066
|
+
var alreadyScoped=text.trimStart().charAt(0)==='('||text.trimStart().charAt(0)===';'||text.indexOf('window.stx.mount')>-1;
|
|
1067
|
+
ns.textContent=alreadyScoped?text:'{'+text+'}';
|
|
1059
1068
|
ns.setAttribute('data-stx-page','');
|
|
1060
1069
|
document.body.appendChild(ns);
|
|
1061
1070
|
});
|
package/dist/serve.js
CHANGED
|
@@ -5160,7 +5160,7 @@ After installing: bun add bun-plugin-stx`);
|
|
|
5160
5160
|
}
|
|
5161
5161
|
sourceFiles = files;
|
|
5162
5162
|
try {
|
|
5163
|
-
const { Router } = await import("./chunk-
|
|
5163
|
+
const { Router } = await import("./chunk-762q71t6.js");
|
|
5164
5164
|
const pagesDir = patterns[0]?.replace(/\/$/, "") || "pages";
|
|
5165
5165
|
const router = new Router(process13.cwd(), { pagesDir });
|
|
5166
5166
|
console.log(`[stx] Generated ${router.routes.length} routes \u2192 .stx/routes.ts`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bun-plugin-stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.12",
|
|
5
5
|
"description": "A Bun plugin that allows for using Laravel Blade-like syntax.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -25,54 +25,28 @@
|
|
|
25
25
|
],
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
|
-
"bun": "./
|
|
28
|
+
"bun": "./dist/index.js",
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"import": "./dist/index.js"
|
|
31
31
|
},
|
|
32
32
|
"./client": {
|
|
33
|
-
"bun": "./
|
|
33
|
+
"bun": "./dist/client.js",
|
|
34
34
|
"types": "./dist/client.d.ts",
|
|
35
35
|
"import": "./dist/client.js"
|
|
36
36
|
},
|
|
37
37
|
"./preload": {
|
|
38
|
-
"bun": "./
|
|
38
|
+
"bun": "./dist/preload.js",
|
|
39
39
|
"import": "./dist/preload.js"
|
|
40
40
|
},
|
|
41
41
|
"./serve": {
|
|
42
|
-
"bun": "./
|
|
42
|
+
"bun": "./dist/serve.js",
|
|
43
43
|
"import": "./dist/serve.js"
|
|
44
44
|
},
|
|
45
45
|
"./*": {
|
|
46
|
-
"bun": "./
|
|
46
|
+
"bun": "./dist/*",
|
|
47
47
|
"import": "./dist/*"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
"publishConfig": {
|
|
51
|
-
"exports": {
|
|
52
|
-
".": {
|
|
53
|
-
"bun": "./dist/index.js",
|
|
54
|
-
"types": "./dist/index.d.ts",
|
|
55
|
-
"import": "./dist/index.js"
|
|
56
|
-
},
|
|
57
|
-
"./client": {
|
|
58
|
-
"bun": "./dist/client.js",
|
|
59
|
-
"types": "./dist/client.d.ts",
|
|
60
|
-
"import": "./dist/client.js"
|
|
61
|
-
},
|
|
62
|
-
"./preload": {
|
|
63
|
-
"bun": "./dist/preload.js",
|
|
64
|
-
"import": "./dist/preload.js"
|
|
65
|
-
},
|
|
66
|
-
"./serve": {
|
|
67
|
-
"bun": "./dist/serve.js",
|
|
68
|
-
"import": "./dist/serve.js"
|
|
69
|
-
},
|
|
70
|
-
"./*": {
|
|
71
|
-
"bun": "./dist/*",
|
|
72
|
-
"import": "./dist/*"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
50
|
"module": "./dist/index.js",
|
|
77
51
|
"types": "./dist/index.d.ts",
|
|
78
52
|
"bin": {
|
|
@@ -98,6 +72,6 @@
|
|
|
98
72
|
"typecheck": "bun tsc --noEmit"
|
|
99
73
|
},
|
|
100
74
|
"dependencies": {
|
|
101
|
-
"@stacksjs/stx": "0.2.
|
|
75
|
+
"@stacksjs/stx": "0.2.12"
|
|
102
76
|
}
|
|
103
77
|
}
|