@crxjs/vite-plugin 2.1.0 → 2.2.1

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.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ConfigEnv, Plugin, PluginOption } from 'vite';
2
+ import { IsStringLiteral } from 'type-fest';
2
3
  import { Options } from 'fast-glob';
3
4
  import { PluginContext, OutputBundle } from 'rollup';
4
5
 
@@ -206,7 +207,8 @@ interface ManifestV3 {
206
207
  type ManifestV3Fn = (env: ConfigEnv) => ManifestV3 | Promise<ManifestV3>;
207
208
  type ManifestV3Export = ManifestV3 | Promise<ManifestV3> | ManifestV3Fn;
208
209
  type Code = '.' | '/' | '\\';
209
- type ManifestFilePath<T extends string> = T extends `${Code}${string}` ? never : T extends `${string}.${infer Ext}` ? Ext extends '' ? never : T : never;
210
+ type LiteralManifestFilePath<T extends string> = T extends `${Code}${string}` ? never : T extends `${string}.${infer Ext}` ? Ext extends '' ? never : T : never;
211
+ type ManifestFilePath<T extends string> = IsStringLiteral<T> extends true ? LiteralManifestFilePath<T> : T;
210
212
  interface ManifestIcons<T extends string> {
211
213
  [size: number]: ManifestFilePath<T>;
212
214
  }
package/dist/index.mjs CHANGED
@@ -107,9 +107,14 @@ const getMatchPatternOrigin = (pattern) => {
107
107
  if (pattern.startsWith("<"))
108
108
  return pattern;
109
109
  const [schema, rest] = pattern.split("://");
110
- const [origin, pathname] = rest.split("/");
110
+ const slashIndex = rest.indexOf("/");
111
+ const isSlashAfterOriginPresent = slashIndex !== -1;
112
+ const origin = isSlashAfterOriginPresent ? rest.slice(0, slashIndex) : rest;
111
113
  const root = `${schema}://${origin}`;
112
- return pathname ? `${root}/*` : root;
114
+ if (isSlashAfterOriginPresent) {
115
+ return `${root}/*`;
116
+ }
117
+ return root;
113
118
  };
114
119
 
115
120
  function defineClientValues(code, config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crxjs/vite-plugin",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "description": "Build Chrome Extensions with this Vite plugin.",
5
5
  "keywords": [
6
6
  "rollup-plugin",
@@ -100,6 +100,7 @@
100
100
  "rollup-plugin-dts": "^4.2.0",
101
101
  "rollup-plugin-esbuild": "4.10.3",
102
102
  "svelte": "^3.48.0",
103
+ "type-fest": "^5.1.0",
103
104
  "typescript": "^4.6.4",
104
105
  "vite": "^3.2.11",
105
106
  "vite-plugin-inspect": "0.7.25",