@inglorious/ssx 2.1.18 → 2.1.20
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/package.json +6 -6
- package/src/build/manifest.js +31 -31
- package/src/router/index.js +26 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/ssx",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.20",
|
|
4
4
|
"description": "Server-Side-X. Xecution? Xperience? Who knows.",
|
|
5
5
|
"author": "Matteo Antony Mistretta <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
},
|
|
49
49
|
"sideEffects": false,
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@inglorious/store": "
|
|
52
|
-
"@inglorious/utils": "5.
|
|
53
|
-
"@inglorious/web": "6.
|
|
51
|
+
"@inglorious/store": "12.0.0",
|
|
52
|
+
"@inglorious/utils": "5.1.0",
|
|
53
|
+
"@inglorious/web": "6.9.0",
|
|
54
54
|
"@lit-labs/ssr": "^4.1.0",
|
|
55
55
|
"commander": "^15.0.0",
|
|
56
56
|
"connect": "^3.7.0",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"vite-plugin-image-optimizer": "^2.0.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@inglorious/eslint-config": "1.
|
|
72
|
-
"@inglorious/logo": "3.0.
|
|
71
|
+
"@inglorious/eslint-config": "1.2.0",
|
|
72
|
+
"@inglorious/logo": "3.0.23",
|
|
73
73
|
"prettier": "^3.9.6",
|
|
74
74
|
"vitest": "^5.0.0"
|
|
75
75
|
},
|
package/src/build/manifest.js
CHANGED
|
@@ -4,17 +4,6 @@ import path from "node:path"
|
|
|
4
4
|
|
|
5
5
|
const MANIFEST_FILE = ".ssx-manifest.json"
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Degraded page hasher used when no Vite server is available: hashes the page
|
|
9
|
-
* module on its own, ignoring everything it imports.
|
|
10
|
-
*
|
|
11
|
-
* @param {Object} page - Page to hash.
|
|
12
|
-
* @returns {Promise<string|null>} Hash of the page module.
|
|
13
|
-
*/
|
|
14
|
-
async function hashPageAlone(page) {
|
|
15
|
-
return await hashFile(page.filePath)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
7
|
const RUNTIME_FILES = [
|
|
19
8
|
"../scripts/app.js",
|
|
20
9
|
"./pages.js",
|
|
@@ -132,26 +121,6 @@ export async function hashRuntime() {
|
|
|
132
121
|
return crypto.createHash("md5").update(contents.join("\n")).digest("hex")
|
|
133
122
|
}
|
|
134
123
|
|
|
135
|
-
/**
|
|
136
|
-
* Determines whether a module id refers to a real source file that should take
|
|
137
|
-
* part in change detection.
|
|
138
|
-
*
|
|
139
|
-
* Virtual modules (Vite internals, `\0`-prefixed) and anything installed under
|
|
140
|
-
* `node_modules` are excluded: they are not the site's own source, and
|
|
141
|
-
* pre-bundled dependency ids are not stable between installs.
|
|
142
|
-
*
|
|
143
|
-
* @param {string|null|undefined} id - Module id from the Vite module graph.
|
|
144
|
-
* @returns {boolean} True if the module should be hashed.
|
|
145
|
-
*/
|
|
146
|
-
function isTrackableModule(id) {
|
|
147
|
-
if (!id || typeof id !== "string") return false
|
|
148
|
-
if (id.startsWith("\0")) return false
|
|
149
|
-
if (!path.isAbsolute(id)) return false
|
|
150
|
-
if (id.split(path.sep).includes("node_modules")) return false
|
|
151
|
-
|
|
152
|
-
return true
|
|
153
|
-
}
|
|
154
|
-
|
|
155
124
|
/**
|
|
156
125
|
* Collects every source file a page depends on, following the Vite module graph
|
|
157
126
|
* so that changes to shared partials (components, nested types, styles, data)
|
|
@@ -296,3 +265,34 @@ export async function createManifest(
|
|
|
296
265
|
buildTime: new Date().toISOString(),
|
|
297
266
|
}
|
|
298
267
|
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Degraded page hasher used when no Vite server is available: hashes the page
|
|
271
|
+
* module on its own, ignoring everything it imports.
|
|
272
|
+
*
|
|
273
|
+
* @param {Object} page - Page to hash.
|
|
274
|
+
* @returns {Promise<string|null>} Hash of the page module.
|
|
275
|
+
*/
|
|
276
|
+
async function hashPageAlone(page) {
|
|
277
|
+
return await hashFile(page.filePath)
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Determines whether a module id refers to a real source file that should take
|
|
282
|
+
* part in change detection.
|
|
283
|
+
*
|
|
284
|
+
* Virtual modules (Vite internals, `\0`-prefixed) and anything installed under
|
|
285
|
+
* `node_modules` are excluded: they are not the site's own source, and
|
|
286
|
+
* pre-bundled dependency ids are not stable between installs.
|
|
287
|
+
*
|
|
288
|
+
* @param {string|null|undefined} id - Module id from the Vite module graph.
|
|
289
|
+
* @returns {boolean} True if the module should be hashed.
|
|
290
|
+
*/
|
|
291
|
+
function isTrackableModule(id) {
|
|
292
|
+
if (!id || typeof id !== "string") return false
|
|
293
|
+
if (id.startsWith("\0")) return false
|
|
294
|
+
if (!path.isAbsolute(id)) return false
|
|
295
|
+
if (id.split(path.sep).includes("node_modules")) return false
|
|
296
|
+
|
|
297
|
+
return true
|
|
298
|
+
}
|
package/src/router/index.js
CHANGED
|
@@ -81,32 +81,6 @@ export async function getPages(pagesDir = "pages", options, loader) {
|
|
|
81
81
|
return pages
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
function addPages(pages, options = {}, pageData) {
|
|
85
|
-
const { i18n = {} } = options
|
|
86
|
-
|
|
87
|
-
if (!i18n.locales?.length) {
|
|
88
|
-
pages.push(pageData)
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
for (const locale of i18n.locales) {
|
|
93
|
-
const isDefault = locale === i18n.defaultLocale
|
|
94
|
-
const prefix = isDefault ? "" : `/${locale}`
|
|
95
|
-
|
|
96
|
-
let localizedPath = prefix + pageData.path
|
|
97
|
-
// Handle root path: / -> / (default), /fr (fr)
|
|
98
|
-
if (pageData.path === "/" && !isDefault) {
|
|
99
|
-
localizedPath = prefix
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
pages.push({
|
|
103
|
-
...pageData,
|
|
104
|
-
path: localizedPath,
|
|
105
|
-
locale,
|
|
106
|
-
})
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
84
|
/**
|
|
111
85
|
* Discovers all page files and converts them into route definitions.
|
|
112
86
|
* Routes are sorted by specificity so that more specific routes match first.
|
|
@@ -285,3 +259,29 @@ function extractParams(route, url) {
|
|
|
285
259
|
|
|
286
260
|
return params
|
|
287
261
|
}
|
|
262
|
+
|
|
263
|
+
function addPages(pages, options = {}, pageData) {
|
|
264
|
+
const { i18n = {} } = options
|
|
265
|
+
|
|
266
|
+
if (!i18n.locales?.length) {
|
|
267
|
+
pages.push(pageData)
|
|
268
|
+
return
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
for (const locale of i18n.locales) {
|
|
272
|
+
const isDefault = locale === i18n.defaultLocale
|
|
273
|
+
const prefix = isDefault ? "" : `/${locale}`
|
|
274
|
+
|
|
275
|
+
let localizedPath = prefix + pageData.path
|
|
276
|
+
// Handle root path: / -> / (default), /fr (fr)
|
|
277
|
+
if (pageData.path === "/" && !isDefault) {
|
|
278
|
+
localizedPath = prefix
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
pages.push({
|
|
282
|
+
...pageData,
|
|
283
|
+
path: localizedPath,
|
|
284
|
+
locale,
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
}
|