vitrify 0.11.8 → 0.11.9
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/index.js +17 -3
- package/package.json +1 -1
- package/src/node/index.ts +22 -5
package/dist/index.js
CHANGED
|
@@ -163,7 +163,9 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
163
163
|
const configPath = fileURLToPath(new URL('vitrify.config.ts', appDir));
|
|
164
164
|
const bundledConfig = await bundleConfigFile(fileURLToPath(new URL('vitrify.config.ts', appDir)));
|
|
165
165
|
fs.writeFileSync(configPath + '.js', bundledConfig.code);
|
|
166
|
-
|
|
166
|
+
// @ts-ignore
|
|
167
|
+
vitrifyConfig = (await import('file://' + configPath + '.js')).default;
|
|
168
|
+
// vitrifyConfig = (await import(configPath + '.js')).default
|
|
167
169
|
fs.unlinkSync(configPath + '.js');
|
|
168
170
|
}
|
|
169
171
|
else {
|
|
@@ -330,11 +332,16 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
330
332
|
.map((url, index) => {
|
|
331
333
|
const varName = fileURLToPath(url)
|
|
332
334
|
.replaceAll('/', '')
|
|
335
|
+
.replaceAll(':', '')
|
|
336
|
+
.replaceAll('\\', '')
|
|
333
337
|
.replaceAll('.', '')
|
|
334
338
|
.replaceAll('-', '')
|
|
335
339
|
.replaceAll('_', '')
|
|
336
340
|
.replaceAll('+', '');
|
|
337
|
-
return `import ${varName} from '${
|
|
341
|
+
return `import ${varName} from '${new URL(url, appDir).pathname}'; onSetup.push(${varName})`;
|
|
342
|
+
// return `import ${varName} from '${fileURLToPath(
|
|
343
|
+
// url
|
|
344
|
+
// )}'; onSetup.push(${varName})`
|
|
338
345
|
})
|
|
339
346
|
.join('\n')}`;
|
|
340
347
|
}
|
|
@@ -390,7 +397,14 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
|
|
|
390
397
|
default:
|
|
391
398
|
entry = fileURLToPath(new URL('csr/entry.ts', frameworkDir));
|
|
392
399
|
}
|
|
393
|
-
|
|
400
|
+
let entryScript;
|
|
401
|
+
if (process.platform === 'win32') {
|
|
402
|
+
const split = entry.split('node_modules');
|
|
403
|
+
entryScript = `<script type="module" src="node_modules${split.at(-1)}"></script>`;
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
entryScript = `<script type="module" src="${entry}"></script>`;
|
|
407
|
+
}
|
|
394
408
|
// html = html.replace('<!--entry-script-->', entryScript)
|
|
395
409
|
html = appendToBody(entryScript, html);
|
|
396
410
|
if (productName)
|
package/package.json
CHANGED
package/src/node/index.ts
CHANGED
|
@@ -235,7 +235,9 @@ export const baseConfig = async ({
|
|
|
235
235
|
fileURLToPath(new URL('vitrify.config.ts', appDir))
|
|
236
236
|
)
|
|
237
237
|
fs.writeFileSync(configPath + '.js', bundledConfig.code)
|
|
238
|
-
|
|
238
|
+
// @ts-ignore
|
|
239
|
+
vitrifyConfig = (await import('file://' + configPath + '.js')).default
|
|
240
|
+
// vitrifyConfig = (await import(configPath + '.js')).default
|
|
239
241
|
fs.unlinkSync(configPath + '.js')
|
|
240
242
|
} else {
|
|
241
243
|
vitrifyConfig = (
|
|
@@ -413,13 +415,20 @@ export const baseConfig = async ({
|
|
|
413
415
|
.map((url, index) => {
|
|
414
416
|
const varName = fileURLToPath(url)
|
|
415
417
|
.replaceAll('/', '')
|
|
418
|
+
.replaceAll(':', '')
|
|
419
|
+
.replaceAll('\\', '')
|
|
416
420
|
.replaceAll('.', '')
|
|
417
421
|
.replaceAll('-', '')
|
|
418
422
|
.replaceAll('_', '')
|
|
419
423
|
.replaceAll('+', '')
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
424
|
+
|
|
425
|
+
return `import ${varName} from '${
|
|
426
|
+
new URL(url, appDir).pathname
|
|
427
|
+
}'; onSetup.push(${varName})`
|
|
428
|
+
|
|
429
|
+
// return `import ${varName} from '${fileURLToPath(
|
|
430
|
+
// url
|
|
431
|
+
// )}'; onSetup.push(${varName})`
|
|
423
432
|
})
|
|
424
433
|
.join('\n')}`
|
|
425
434
|
} else if (id === 'virtual:static-imports') {
|
|
@@ -479,7 +488,15 @@ export const baseConfig = async ({
|
|
|
479
488
|
default:
|
|
480
489
|
entry = fileURLToPath(new URL('csr/entry.ts', frameworkDir))
|
|
481
490
|
}
|
|
482
|
-
|
|
491
|
+
let entryScript
|
|
492
|
+
if (process.platform === 'win32') {
|
|
493
|
+
const split = entry.split('node_modules')
|
|
494
|
+
entryScript = `<script type="module" src="node_modules${split.at(
|
|
495
|
+
-1
|
|
496
|
+
)}"></script>`
|
|
497
|
+
} else {
|
|
498
|
+
entryScript = `<script type="module" src="${entry}"></script>`
|
|
499
|
+
}
|
|
483
500
|
// html = html.replace('<!--entry-script-->', entryScript)
|
|
484
501
|
html = appendToBody(entryScript, html)
|
|
485
502
|
if (productName) html = addOrReplaceTitle(productName, html)
|