@crxjs/vite-plugin 1.0.6 → 1.0.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @crxjs/vite-plugin
2
2
 
3
+ ## 1.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - e1604d8: Strip paths from content script resource match patterns
8
+
3
9
  ## 1.0.6
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -132,6 +132,12 @@ function encodeManifest(manifest) {
132
132
  const json = JSON.stringify(JSON.stringify(manifest));
133
133
  return `export default ${json}`;
134
134
  }
135
+ const stubMatchPattern = (pattern) => {
136
+ const [schema, rest] = pattern.split("://");
137
+ const [origin, pathname] = rest.split("/");
138
+ const root = `${schema}://${origin}`;
139
+ return pathname ? `${root}/*` : root;
140
+ };
135
141
 
136
142
  const idBySource = /* @__PURE__ */ new Map();
137
143
  const idByUrl = /* @__PURE__ */ new Map();
@@ -3332,6 +3338,7 @@ const pluginResources = ({ contentScripts = {} }) => {
3332
3338
  resource.resources.push(...css);
3333
3339
  }
3334
3340
  if (resource.resources.length) {
3341
+ resource.matches = resource.matches.map(stubMatchPattern);
3335
3342
  manifest.web_accessible_resources.push(resource);
3336
3343
  }
3337
3344
  }
package/dist/index.mjs CHANGED
@@ -99,6 +99,12 @@ function encodeManifest(manifest) {
99
99
  const json = JSON.stringify(JSON.stringify(manifest));
100
100
  return `export default ${json}`;
101
101
  }
102
+ const stubMatchPattern = (pattern) => {
103
+ const [schema, rest] = pattern.split("://");
104
+ const [origin, pathname] = rest.split("/");
105
+ const root = `${schema}://${origin}`;
106
+ return pathname ? `${root}/*` : root;
107
+ };
102
108
 
103
109
  const idBySource = /* @__PURE__ */ new Map();
104
110
  const idByUrl = /* @__PURE__ */ new Map();
@@ -3299,6 +3305,7 @@ const pluginResources = ({ contentScripts = {} }) => {
3299
3305
  resource.resources.push(...css);
3300
3306
  }
3301
3307
  if (resource.resources.length) {
3308
+ resource.matches = resource.matches.map(stubMatchPattern);
3302
3309
  manifest.web_accessible_resources.push(resource);
3303
3310
  }
3304
3311
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crxjs/vite-plugin",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Build Chrome Extensions with this Vite plugin.",
5
5
  "keywords": [
6
6
  "rollup-plugin",
@@ -83,15 +83,15 @@
83
83
  "@rollup/plugin-commonjs": "21.1.0",
84
84
  "@rollup/plugin-node-resolve": "13.2.0",
85
85
  "@types/acorn": "4.0.6",
86
- "@types/chrome": "0.0.184",
86
+ "@types/chrome": "0.0.188",
87
87
  "@types/debug": "4.1.7",
88
88
  "@types/fs-extra": "9.0.13",
89
- "@types/jest": "27.5.0",
89
+ "@types/jest": "27.5.1",
90
90
  "@types/jest-image-snapshot": "4.3.1",
91
91
  "@types/jsesc": "3.0.1",
92
92
  "@types/node": "17.0.18",
93
93
  "@types/react": "17.0.44",
94
- "@types/react-dom": "17.0.16",
94
+ "@types/react-dom": "17.0.17",
95
95
  "@typescript-eslint/eslint-plugin": "5.23.0",
96
96
  "@typescript-eslint/parser": "5.23.0",
97
97
  "@vitejs/plugin-react": "1.3.2",
@@ -111,7 +111,7 @@
111
111
  "typescript": "^4.6.4",
112
112
  "vite": "^2.9.5",
113
113
  "vite-plugin-inspect": "0.5.0",
114
- "vue": "3.2.33"
114
+ "vue": "3.2.36"
115
115
  },
116
116
  "peerDependencies": {
117
117
  "vite": "^2.9.0"