@crxjs/vite-plugin 2.0.0-beta.13 → 2.0.0-beta.14
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.mjs +29 -18
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -477,7 +477,7 @@ async function allFilesReady() {
|
|
|
477
477
|
await firstValueFrom(allFilesReady$);
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
const { outputFile
|
|
480
|
+
const { outputFile } = fsx;
|
|
481
481
|
_debug("file-writer");
|
|
482
482
|
async function start({
|
|
483
483
|
server
|
|
@@ -498,8 +498,6 @@ async function start({
|
|
|
498
498
|
dir: outDir,
|
|
499
499
|
format: "es"
|
|
500
500
|
};
|
|
501
|
-
if (server.config.build.emptyOutDir)
|
|
502
|
-
await remove(server.config.build.outDir);
|
|
503
501
|
fileWriterEvent$.next({ type: "build_start" });
|
|
504
502
|
const build = await rollup(inputOptions);
|
|
505
503
|
await build.write(outputOptions);
|
|
@@ -868,29 +866,42 @@ const pluginDynamicContentScripts = () => {
|
|
|
868
866
|
];
|
|
869
867
|
};
|
|
870
868
|
|
|
869
|
+
const { remove } = fsx;
|
|
871
870
|
const logger = createLogger("error", { prefix: "crxjs" });
|
|
872
871
|
const pluginFileWriter = () => {
|
|
873
872
|
fileWriterError$.subscribe((error) => {
|
|
874
873
|
logger.error(error.err.message, { error: error.err });
|
|
875
874
|
});
|
|
876
|
-
return
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
console.error(error);
|
|
885
|
-
server.close();
|
|
875
|
+
return [
|
|
876
|
+
{
|
|
877
|
+
name: "crx:file-writer-empty-out-dir",
|
|
878
|
+
apply: "serve",
|
|
879
|
+
enforce: "pre",
|
|
880
|
+
async configResolved(config) {
|
|
881
|
+
if (config.build.emptyOutDir) {
|
|
882
|
+
await remove(config.build.outDir);
|
|
886
883
|
}
|
|
887
|
-
}
|
|
888
|
-
server.httpServer?.on("close", () => close());
|
|
884
|
+
}
|
|
889
885
|
},
|
|
890
|
-
|
|
891
|
-
|
|
886
|
+
{
|
|
887
|
+
name: "crx:file-writer",
|
|
888
|
+
apply: "serve",
|
|
889
|
+
configureServer(server) {
|
|
890
|
+
server.httpServer?.on("listening", async () => {
|
|
891
|
+
try {
|
|
892
|
+
await start({ server });
|
|
893
|
+
} catch (error) {
|
|
894
|
+
console.error(error);
|
|
895
|
+
server.close();
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
server.httpServer?.on("close", () => close());
|
|
899
|
+
},
|
|
900
|
+
closeBundle() {
|
|
901
|
+
outputFiles.clear();
|
|
902
|
+
}
|
|
892
903
|
}
|
|
893
|
-
|
|
904
|
+
];
|
|
894
905
|
};
|
|
895
906
|
|
|
896
907
|
const _require = typeof require === "undefined" ? createRequire(import.meta.url) : require;
|