vitrify 0.13.1 → 0.13.2

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 CHANGED
@@ -250,10 +250,10 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
250
250
  name: 'vitrify-transforms',
251
251
  enforce: 'pre',
252
252
  transform: (code, id) => {
253
- // if (['main.ts', 'vitrify'].every((val) => id.includes(val))) {
254
- // code =
255
- // `${globalCss.map((css) => `import '${css}'`).join('\n')}\n` + code
256
- // }
253
+ if (['main.ts', 'vitrify'].every((val) => id.includes(val))) {
254
+ if (!isPwa)
255
+ code = code.replace(/\/\/ @vitrify-pwa-only((.|\n)*)\/\/ @vitrify-pwa-only-end/, '');
256
+ }
257
257
  if (['RootComponent.vue', 'vitrify'].every((val) => id.includes(val))) {
258
258
  const css = `${globalCss
259
259
  .map((css) => `@import '${css}';`)
@@ -466,11 +466,7 @@ export const baseConfig = async ({ ssr, appDir, publicDir, base = '/', command =
466
466
  let noExternal = [
467
467
  new RegExp(`^(?!(${[...builtinModules, ...serverModules].join('|')}))`)
468
468
  ];
469
- const external = [
470
- ...builtinModules,
471
- ...serverModules,
472
- 'virtual:pwa-register/vue'
473
- ];
469
+ const external = [...builtinModules, ...serverModules];
474
470
  if (ssr === 'server') {
475
471
  rollupOptions = {
476
472
  ...rollupOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitrify",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "license": "MIT",
5
5
  "author": "Stefan van Herwijnen",
6
6
  "description": "Vite as your Full Stack development tool",
package/src/node/index.ts CHANGED
@@ -327,10 +327,13 @@ export const baseConfig = async ({
327
327
  name: 'vitrify-transforms',
328
328
  enforce: 'pre',
329
329
  transform: (code, id) => {
330
- // if (['main.ts', 'vitrify'].every((val) => id.includes(val))) {
331
- // code =
332
- // `${globalCss.map((css) => `import '${css}'`).join('\n')}\n` + code
333
- // }
330
+ if (['main.ts', 'vitrify'].every((val) => id.includes(val))) {
331
+ if (!isPwa)
332
+ code = code.replace(
333
+ /\/\/ @vitrify-pwa-only((.|\n)*)\/\/ @vitrify-pwa-only-end/,
334
+ ''
335
+ )
336
+ }
334
337
  if (['RootComponent.vue', 'vitrify'].every((val) => id.includes(val))) {
335
338
  const css = `${globalCss
336
339
  .map((css) => `@import '${css}';`)
@@ -564,11 +567,7 @@ export const baseConfig = async ({
564
567
  let noExternal: RegExp[] | string[] = [
565
568
  new RegExp(`^(?!(${[...builtinModules, ...serverModules].join('|')}))`)
566
569
  ]
567
- const external = [
568
- ...builtinModules,
569
- ...serverModules,
570
- 'virtual:pwa-register/vue'
571
- ]
570
+ const external = [...builtinModules, ...serverModules]
572
571
 
573
572
  if (ssr === 'server') {
574
573
  rollupOptions = {
@@ -78,10 +78,14 @@ export async function createApp(
78
78
  await fn({ app, ssrContext, staticImports })
79
79
  }
80
80
 
81
- if (__IS_PWA__ && typeof window !== 'undefined') {
82
- const { registerPWA } = await import('./pwa.js')
83
- registerPWA(router)
81
+ // @vitrify-pwa-only
82
+ if (__IS_PWA__) {
83
+ if (typeof window !== 'undefined') {
84
+ const { registerPWA } = await import('./pwa.js')
85
+ registerPWA(router)
86
+ }
84
87
  }
88
+ // @vitrify-pwa-only-end
85
89
 
86
90
  return { app, router, routes }
87
91
  }