pulse-js-framework 1.11.2 → 1.11.4
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/cli/analyze.js +21 -8
- package/cli/build.js +83 -56
- package/cli/dev.js +108 -94
- package/cli/docs-test.js +52 -33
- package/cli/index.js +81 -51
- package/cli/mobile.js +92 -40
- package/cli/release.js +64 -46
- package/cli/scaffold.js +14 -13
- package/compiler/lexer.js +55 -54
- package/compiler/parser/core.js +1 -0
- package/compiler/parser/state.js +6 -12
- package/compiler/parser/style.js +17 -20
- package/compiler/parser/view.js +1 -3
- package/compiler/preprocessor.js +124 -262
- package/compiler/sourcemap.js +10 -4
- package/compiler/transformer/expressions.js +122 -106
- package/compiler/transformer/index.js +2 -4
- package/compiler/transformer/style.js +74 -7
- package/compiler/transformer/view.js +86 -36
- package/loader/esbuild-plugin-server-components.js +209 -0
- package/loader/esbuild-plugin.js +41 -93
- package/loader/parcel-plugin.js +37 -97
- package/loader/rollup-plugin-server-components.js +30 -169
- package/loader/rollup-plugin.js +27 -78
- package/loader/shared.js +362 -0
- package/loader/swc-plugin.js +65 -82
- package/loader/vite-plugin-server-components.js +30 -171
- package/loader/vite-plugin.js +25 -10
- package/loader/webpack-loader-server-components.js +21 -134
- package/loader/webpack-loader.js +25 -80
- package/package.json +52 -12
- package/runtime/dom-selector.js +2 -1
- package/runtime/form.js +4 -3
- package/runtime/http.js +6 -1
- package/runtime/logger.js +44 -24
- package/runtime/router/utils.js +14 -7
- package/runtime/security.js +13 -1
- package/runtime/server-components/actions-server.js +23 -19
- package/runtime/server-components/error-sanitizer.js +18 -18
- package/runtime/server-components/security.js +41 -24
- package/runtime/ssr-preload.js +5 -3
- package/runtime/testing.js +759 -0
- package/runtime/utils.js +3 -2
- package/server/utils.js +15 -9
- package/sw/index.js +2 -0
- package/types/loaders.d.ts +1043 -0
- package/compiler/parser/_extract.js +0 -393
- package/loader/README.md +0 -509
package/runtime/utils.js
CHANGED
|
@@ -30,12 +30,13 @@ export { escapeHtml, sanitizeUrl };
|
|
|
30
30
|
*/
|
|
31
31
|
export function unescapeHtml(str) {
|
|
32
32
|
if (str == null) return '';
|
|
33
|
+
// Unescape & LAST to avoid double-unescaping (e.g., '&lt;' -> '<' -> '<')
|
|
33
34
|
return String(str)
|
|
34
|
-
.replace(/&/g, '&')
|
|
35
35
|
.replace(/</g, '<')
|
|
36
36
|
.replace(/>/g, '>')
|
|
37
37
|
.replace(/"/g, '"')
|
|
38
|
-
.replace(/'/g, "'")
|
|
38
|
+
.replace(/'/g, "'")
|
|
39
|
+
.replace(/&/g, '&');
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
/**
|
package/server/utils.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module pulse-js-framework/server/utils
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { readFileSync
|
|
10
|
+
import { readFileSync } from 'fs';
|
|
11
11
|
import { extname, resolve, sep } from 'path';
|
|
12
12
|
|
|
13
13
|
// ============================================================================
|
|
@@ -104,11 +104,15 @@ export function readTemplate(templatePath) {
|
|
|
104
104
|
return templateCache.get(templatePath);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
let content;
|
|
108
|
+
try {
|
|
109
|
+
content = readFileSync(templatePath, 'utf-8');
|
|
110
|
+
} catch (e) {
|
|
111
|
+
if (e.code === 'ENOENT') {
|
|
112
|
+
throw new Error(`[Pulse Server] Template not found: ${templatePath}`);
|
|
113
|
+
}
|
|
114
|
+
throw e;
|
|
109
115
|
}
|
|
110
|
-
|
|
111
|
-
const content = readFileSync(templatePath, 'utf-8');
|
|
112
116
|
templateCache.set(templatePath, content);
|
|
113
117
|
return content;
|
|
114
118
|
}
|
|
@@ -155,11 +159,13 @@ export function resolveStaticAsset(pathname, distDir, options = {}) {
|
|
|
155
159
|
return null;
|
|
156
160
|
}
|
|
157
161
|
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
let content;
|
|
163
|
+
try {
|
|
164
|
+
content = readFileSync(filePath);
|
|
165
|
+
} catch (err) {
|
|
166
|
+
if (err.code === 'ENOENT' || err.code === 'EISDIR') return null;
|
|
167
|
+
throw err;
|
|
160
168
|
}
|
|
161
|
-
|
|
162
|
-
const content = readFileSync(filePath);
|
|
163
169
|
const mimeType = getMimeType(filePath);
|
|
164
170
|
|
|
165
171
|
// Hashed assets get long cache
|
package/sw/index.js
CHANGED
|
@@ -224,6 +224,8 @@ export function createCacheStrategy(name, options = {}) {
|
|
|
224
224
|
*/
|
|
225
225
|
export function enableSkipWaiting() {
|
|
226
226
|
self.addEventListener('message', (event) => {
|
|
227
|
+
// Validate origin: only accept messages from the same origin as the service worker
|
|
228
|
+
if (event.origin && event.origin !== self.location.origin) return;
|
|
227
229
|
if (event.data?.type === 'SKIP_WAITING') {
|
|
228
230
|
self.skipWaiting();
|
|
229
231
|
}
|