@nuxt/vite-builder-nightly 4.1.3-29310511.cb2b9d5f → 4.1.3-29312995.d3ce79f3

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.
Files changed (2) hide show
  1. package/dist/index.mjs +17 -3
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -28,7 +28,7 @@ import { colorize } from 'consola/utils';
28
28
  import escapeStringRegexp from 'escape-string-regexp';
29
29
  import { isBuiltin } from 'node:module';
30
30
  import { createJiti } from 'jiti';
31
- import { genImport, genObjectFromRawEntries } from 'knitwork';
31
+ import { genImport, genArrayFromRaw, genObjectFromRawEntries } from 'knitwork';
32
32
 
33
33
  function isVue(id, opts = {}) {
34
34
  const { search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
@@ -1501,12 +1501,26 @@ function SSRStylesPlugin(options) {
1501
1501
  source: ""
1502
1502
  });
1503
1503
  const baseDir = dirname(base);
1504
+ const cssImports = /* @__PURE__ */ new Set();
1505
+ const exportNames = /* @__PURE__ */ new Set();
1506
+ const importStatements = /* @__PURE__ */ new Set();
1507
+ let i = 0;
1508
+ for (const css of files) {
1509
+ const file2 = this.getFileName(css);
1510
+ if (cssImports.has(file2)) {
1511
+ continue;
1512
+ }
1513
+ cssImports.add(file2);
1514
+ const name = `style_${i++}`;
1515
+ importStatements.add(genImport(`./${relative(baseDir, file2)}`, name));
1516
+ exportNames.add(name);
1517
+ }
1504
1518
  emitted[file] = this.emitFile({
1505
1519
  type: "asset",
1506
1520
  name: `${fileName}-styles.mjs`,
1507
1521
  source: [
1508
- ...files.map((css, i) => `import style_${i} from './${relative(baseDir, this.getFileName(css))}';`),
1509
- `export default [${files.map((_, i) => `style_${i}`).join(", ")}]`
1522
+ ...importStatements,
1523
+ `export default ${genArrayFromRaw([...exportNames])}`
1510
1524
  ].join("\n")
1511
1525
  });
1512
1526
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/vite-builder-nightly",
3
- "version": "4.1.3-29310511.cb2b9d5f",
3
+ "version": "4.1.3-29312995.d3ce79f3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -21,7 +21,7 @@
21
21
  "dist"
22
22
  ],
23
23
  "devDependencies": {
24
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.3-29310511.cb2b9d5f",
24
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.1.3-29312995.d3ce79f3",
25
25
  "nitropack": "2.12.6",
26
26
  "rolldown": "1.0.0-beta.38",
27
27
  "rollup": "4.50.2",
@@ -29,7 +29,7 @@
29
29
  "vue": "3.5.21"
30
30
  },
31
31
  "dependencies": {
32
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.3-29310511.cb2b9d5f",
32
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.1.3-29312995.d3ce79f3",
33
33
  "@rollup/plugin-replace": "^6.0.2",
34
34
  "@vitejs/plugin-vue": "^6.0.1",
35
35
  "@vitejs/plugin-vue-jsx": "^5.1.1",