@uni_toolkit/unplugin-json-optimization 0.0.10-alpha.1762396524408 → 0.0.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.
@@ -4,7 +4,7 @@ import { createFilter } from "@rollup/pluginutils";
4
4
  import path from "path";
5
5
  var unpluginFactory = (options = {
6
6
  includes: ["**/*.json"],
7
- excludes: ["pages.json", "**/uni_modules/*.json"]
7
+ excludes: ["pages.json", "**/uni_modules/**/*.json"]
8
8
  }) => {
9
9
  const jsonFiles = /* @__PURE__ */ new Set();
10
10
  const inputDir = process.env.UNI_INPUT_DIR;
@@ -20,12 +20,12 @@ var unpluginFactory = (options = {
20
20
  }
21
21
  },
22
22
  generateBundle(_, bundle) {
23
- for (const [, chunk] of Object.entries(bundle)) {
24
- if (chunk.type !== "chunk" || !chunk.moduleIds) {
23
+ for (const [fileName, chunk] of Object.entries(bundle)) {
24
+ if (chunk.type !== "chunk" || !chunk.moduleIds || !chunk.moduleIds.length || fileName.includes("/")) {
25
25
  continue;
26
26
  }
27
27
  const id = chunk.moduleIds.find((id2) => jsonFiles.has(id2));
28
- if (id && !id.includes("/")) {
28
+ if (id) {
29
29
  const relativePath = path.relative(inputDir, id);
30
30
  const { dir, name } = path.parse(relativePath);
31
31
  chunk.fileName = `${path.join(dir, name)}.js`;
package/dist/index.cjs CHANGED
@@ -40,7 +40,7 @@ var import_pluginutils = require("@rollup/pluginutils");
40
40
  var import_node_path = __toESM(require("path"), 1);
41
41
  var unpluginFactory = (options = {
42
42
  includes: ["**/*.json"],
43
- excludes: ["pages.json", "**/uni_modules/*.json"]
43
+ excludes: ["pages.json", "**/uni_modules/**/*.json"]
44
44
  }) => {
45
45
  const jsonFiles = /* @__PURE__ */ new Set();
46
46
  const inputDir = process.env.UNI_INPUT_DIR;
@@ -56,12 +56,12 @@ var unpluginFactory = (options = {
56
56
  }
57
57
  },
58
58
  generateBundle(_, bundle) {
59
- for (const [, chunk] of Object.entries(bundle)) {
60
- if (chunk.type !== "chunk" || !chunk.moduleIds) {
59
+ for (const [fileName, chunk] of Object.entries(bundle)) {
60
+ if (chunk.type !== "chunk" || !chunk.moduleIds || !chunk.moduleIds.length || fileName.includes("/")) {
61
61
  continue;
62
62
  }
63
63
  const id = chunk.moduleIds.find((id2) => jsonFiles.has(id2));
64
- if (id && !id.includes("/")) {
64
+ if (id) {
65
65
  const relativePath = import_node_path.default.relative(inputDir, id);
66
66
  const { dir, name } = import_node_path.default.parse(relativePath);
67
67
  chunk.fileName = `${import_node_path.default.join(dir, name)}.js`;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  src_default,
3
3
  unplugin,
4
4
  unpluginFactory
5
- } from "./chunk-EUN6NT5L.js";
5
+ } from "./chunk-5WLD335P.js";
6
6
  export {
7
7
  src_default as default,
8
8
  unplugin,
package/dist/vite.cjs CHANGED
@@ -41,7 +41,7 @@ var import_pluginutils = require("@rollup/pluginutils");
41
41
  var import_node_path = __toESM(require("path"), 1);
42
42
  var unpluginFactory = (options = {
43
43
  includes: ["**/*.json"],
44
- excludes: ["pages.json", "**/uni_modules/*.json"]
44
+ excludes: ["pages.json", "**/uni_modules/**/*.json"]
45
45
  }) => {
46
46
  const jsonFiles = /* @__PURE__ */ new Set();
47
47
  const inputDir = process.env.UNI_INPUT_DIR;
@@ -57,12 +57,12 @@ var unpluginFactory = (options = {
57
57
  }
58
58
  },
59
59
  generateBundle(_, bundle) {
60
- for (const [, chunk] of Object.entries(bundle)) {
61
- if (chunk.type !== "chunk" || !chunk.moduleIds) {
60
+ for (const [fileName, chunk] of Object.entries(bundle)) {
61
+ if (chunk.type !== "chunk" || !chunk.moduleIds || !chunk.moduleIds.length || fileName.includes("/")) {
62
62
  continue;
63
63
  }
64
64
  const id = chunk.moduleIds.find((id2) => jsonFiles.has(id2));
65
- if (id && !id.includes("/")) {
65
+ if (id) {
66
66
  const relativePath = import_node_path.default.relative(inputDir, id);
67
67
  const { dir, name } = import_node_path.default.parse(relativePath);
68
68
  chunk.fileName = `${import_node_path.default.join(dir, name)}.js`;
package/dist/vite.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-EUN6NT5L.js";
3
+ } from "./chunk-5WLD335P.js";
4
4
 
5
5
  // src/vite.ts
6
6
  import { createVitePlugin } from "unplugin";
package/dist/webpack.cjs CHANGED
@@ -41,7 +41,7 @@ var import_pluginutils = require("@rollup/pluginutils");
41
41
  var import_node_path = __toESM(require("path"), 1);
42
42
  var unpluginFactory = (options = {
43
43
  includes: ["**/*.json"],
44
- excludes: ["pages.json", "**/uni_modules/*.json"]
44
+ excludes: ["pages.json", "**/uni_modules/**/*.json"]
45
45
  }) => {
46
46
  const jsonFiles = /* @__PURE__ */ new Set();
47
47
  const inputDir = process.env.UNI_INPUT_DIR;
@@ -57,12 +57,12 @@ var unpluginFactory = (options = {
57
57
  }
58
58
  },
59
59
  generateBundle(_, bundle) {
60
- for (const [, chunk] of Object.entries(bundle)) {
61
- if (chunk.type !== "chunk" || !chunk.moduleIds) {
60
+ for (const [fileName, chunk] of Object.entries(bundle)) {
61
+ if (chunk.type !== "chunk" || !chunk.moduleIds || !chunk.moduleIds.length || fileName.includes("/")) {
62
62
  continue;
63
63
  }
64
64
  const id = chunk.moduleIds.find((id2) => jsonFiles.has(id2));
65
- if (id && !id.includes("/")) {
65
+ if (id) {
66
66
  const relativePath = import_node_path.default.relative(inputDir, id);
67
67
  const { dir, name } = import_node_path.default.parse(relativePath);
68
68
  chunk.fileName = `${import_node_path.default.join(dir, name)}.js`;
package/dist/webpack.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-EUN6NT5L.js";
3
+ } from "./chunk-5WLD335P.js";
4
4
 
5
5
  // src/webpack.ts
6
6
  import { createWebpackPlugin } from "unplugin";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uni_toolkit/unplugin-json-optimization",
3
3
  "type": "module",
4
- "version": "0.0.10-alpha.1762396524408",
4
+ "version": "0.0.10",
5
5
  "description": "A plugin to optimize json files generation",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/uni-toolkit/uni-toolkit/tree/main/packages/unplugin-json-optimization",