@crxjs/vite-plugin 2.0.0-beta.14 → 2.0.0-beta.15

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 +6 -6
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { createHash } from 'crypto';
3
3
  import debug$3 from 'debug';
4
4
  import v8 from 'v8';
5
5
  import { posix } from 'path';
6
- import { Subject, filter, ReplaySubject, switchMap, of, startWith, map, mergeMap, firstValueFrom, takeUntil, first, toArray, retry, concatWith, Subscription, buffer } from 'rxjs';
6
+ import { Subject, filter, ReplaySubject, switchMap, of, startWith, map, BehaviorSubject, mergeMap, firstValueFrom, takeUntil, first, toArray, retry, concatWith, Subscription, buffer } from 'rxjs';
7
7
  import fsx from 'fs-extra';
8
8
  import { performance } from 'perf_hooks';
9
9
  import { rollup } from 'rollup';
@@ -397,6 +397,10 @@ const allFilesReady$ = buildEnd$.pipe(
397
397
  map(() => [...outputFiles.values()]),
398
398
  switchMap((files) => Promise.allSettled(files.map(({ file }) => file)))
399
399
  );
400
+ const timestamp$ = new BehaviorSubject(Date.now());
401
+ allFilesReady$.subscribe(() => {
402
+ timestamp$.next(Date.now());
403
+ });
400
404
  const isRejected = (x) => x?.status === "rejected";
401
405
  const fileWriterError$ = allFilesReady$.pipe(
402
406
  mergeMap((results) => results.filter(isRejected)),
@@ -458,14 +462,10 @@ function prepScript(fileName, script) {
458
462
  const [imports] = lexer.parse(code, fileName);
459
463
  const depSet = new Set(deps);
460
464
  const magic = new MagicString(code);
461
- const now = Date.now();
462
465
  for (const i of imports)
463
466
  if (i.n) {
464
467
  depSet.add(i.n);
465
- let fileName2 = getFileName({ type: "module", id: i.n });
466
- if (!fileName2.startsWith("vendor")) {
467
- fileName2 = `${fileName2}?t=${now}`;
468
- }
468
+ const fileName2 = getFileName({ type: "module", id: i.n });
469
469
  const fullImport = code.substring(i.s, i.e);
470
470
  magic.overwrite(i.s, i.e, fullImport.replace(i.n, `/${fileName2}`));
471
471
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crxjs/vite-plugin",
3
- "version": "2.0.0-beta.14",
3
+ "version": "2.0.0-beta.15",
4
4
  "description": "Build Chrome Extensions with this Vite plugin.",
5
5
  "keywords": [
6
6
  "rollup-plugin",