vitrify 0.11.8 → 0.11.10

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/bin/cli.js CHANGED
@@ -71,12 +71,17 @@ cli
71
71
  ...args,
72
72
  outDir: fileURLToPath(new URL('ssr/server/', baseOutDir))
73
73
  });
74
- ({ prerender, onRendered } = await import(fileURLToPath(new URL('ssr/server/prerender.mjs', baseOutDir))));
74
+ ({ prerender, onRendered } = await import(
75
+ // @ts-ignore
76
+ new URL('ssr/server/prerender.mjs', baseOutDir)));
77
+ // ;({ prerender, onRendered } = await import(
78
+ // fileURLToPath(new URL('ssr/server/prerender.mjs', baseOutDir))
79
+ // ))
75
80
  prerender({
76
81
  outDir: fileURLToPath(new URL('static/', baseOutDir)),
77
82
  templatePath: fileURLToPath(new URL('static/index.html', baseOutDir)),
78
83
  manifestPath: fileURLToPath(new URL('static/ssr-manifest.json', baseOutDir)),
79
- entryServerPath: fileURLToPath(new URL('ssr/server/entry-server.mjs', baseOutDir)),
84
+ entryServerPath: new URL('ssr/server/entry-server.mjs', baseOutDir),
80
85
  onRendered
81
86
  });
82
87
  break;
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
- vitrifyConfig = (await import(configPath + '.js')).default;
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 '${fileURLToPath(url)}'; onSetup.push(${varName})`;
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
- const entryScript = `<script type="module" src="${entry}"></script>`;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitrify",
3
- "version": "0.11.8",
3
+ "version": "0.11.10",
4
4
  "license": "MIT",
5
5
  "author": "Stefan van Herwijnen",
6
6
  "description": "Vite as your Full Stack development tool",
@@ -83,18 +83,21 @@ cli
83
83
  outDir: fileURLToPath(new URL('ssr/server/', baseOutDir))
84
84
  })
85
85
  ;({ prerender, onRendered } = await import(
86
- fileURLToPath(new URL('ssr/server/prerender.mjs', baseOutDir))
86
+ // @ts-ignore
87
+ new URL('ssr/server/prerender.mjs', baseOutDir)
87
88
  ))
88
89
 
90
+ // ;({ prerender, onRendered } = await import(
91
+ // fileURLToPath(new URL('ssr/server/prerender.mjs', baseOutDir))
92
+ // ))
93
+
89
94
  prerender({
90
95
  outDir: fileURLToPath(new URL('static/', baseOutDir)),
91
96
  templatePath: fileURLToPath(new URL('static/index.html', baseOutDir)),
92
97
  manifestPath: fileURLToPath(
93
98
  new URL('static/ssr-manifest.json', baseOutDir)
94
99
  ),
95
- entryServerPath: fileURLToPath(
96
- new URL('ssr/server/entry-server.mjs', baseOutDir)
97
- ),
100
+ entryServerPath: new URL('ssr/server/entry-server.mjs', baseOutDir),
98
101
  onRendered
99
102
  })
100
103
  break
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
- vitrifyConfig = (await import(configPath + '.js')).default
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
- return `import ${varName} from '${fileURLToPath(
421
- url
422
- )}'; onSetup.push(${varName})`
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
- const entryScript = `<script type="module" src="${entry}"></script>`
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)