wxt 0.1.1-alpha3 → 0.1.1-alpha4
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/cli.cjs +49 -49
- package/dist/index.cjs +38 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +38 -38
- package/dist/index.js.map +1 -1
- package/dist/virtual-modules/background-entrypoint.js.map +1 -1
- package/dist/virtual-modules/content-script-entrypoint.js.map +1 -1
- package/dist/virtual-modules/reload-html.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -574,7 +574,7 @@ function findEffectedSteps(changedFile, currentOutput) {
|
|
|
574
574
|
|
|
575
575
|
// src/index.ts
|
|
576
576
|
var import_async_mutex = require("async-mutex");
|
|
577
|
-
var
|
|
577
|
+
var import_consola2 = require("consola");
|
|
578
578
|
var import_node_path4 = require("path");
|
|
579
579
|
|
|
580
580
|
// src/core/build/buildEntrypoints.ts
|
|
@@ -716,47 +716,47 @@ var import_linkedom2 = require("linkedom");
|
|
|
716
716
|
var import_json5 = __toESM(require("json5"), 1);
|
|
717
717
|
|
|
718
718
|
// src/core/utils/importTsFile.ts
|
|
719
|
-
var
|
|
720
|
-
var import_babel = __toESM(require("jiti/dist/babel"), 1);
|
|
719
|
+
var import_jiti = __toESM(require("jiti"), 1);
|
|
721
720
|
var import_unimport2 = require("unimport");
|
|
722
721
|
var import_fs_extra6 = __toESM(require("fs-extra"), 1);
|
|
723
|
-
var import_c122 = require("c12");
|
|
724
722
|
var import_path6 = require("path");
|
|
723
|
+
var import_babel = __toESM(require("jiti/dist/babel"), 1);
|
|
725
724
|
async function importTsFile(path5, config) {
|
|
726
|
-
|
|
727
|
-
const unimport2 = (0, import_unimport2.createUnimport)(
|
|
728
|
-
|
|
725
|
+
config.logger.log("Loading file metadata:", path5);
|
|
726
|
+
const unimport2 = (0, import_unimport2.createUnimport)({
|
|
727
|
+
...getUnimportOptions(config),
|
|
728
|
+
// Only allow specific imports, not all from the project
|
|
729
|
+
imports: [{ name: "*", as: "browser", from: "webextension-polyfill" }],
|
|
730
|
+
dirs: []
|
|
731
|
+
});
|
|
732
|
+
await unimport2.init();
|
|
729
733
|
const text = await import_fs_extra6.default.readFile(path5, "utf-8");
|
|
730
|
-
const
|
|
731
|
-
const
|
|
734
|
+
const textNoImports = text.replace(/import.*[\n;]/gm, "");
|
|
735
|
+
const { code } = await unimport2.injectImports(textNoImports);
|
|
736
|
+
config.logger.log(
|
|
737
|
+
["Text:", text, "No imports:", textNoImports, "Code:", code].join("\n")
|
|
738
|
+
);
|
|
739
|
+
const jiti = (0, import_jiti.default)(__filename, {
|
|
740
|
+
cache: false,
|
|
741
|
+
esmResolve: true,
|
|
742
|
+
interopDefault: true,
|
|
743
|
+
alias: {
|
|
744
|
+
"webextension-polyfill": (0, import_path6.resolve)(
|
|
745
|
+
config.root,
|
|
746
|
+
"node_modules/wxt/dist/virtual-modules/fake-browser.js"
|
|
747
|
+
)
|
|
748
|
+
},
|
|
749
|
+
transform(opts) {
|
|
750
|
+
if (opts.filename === path5)
|
|
751
|
+
return (0, import_babel.default)({ ...opts, source: code });
|
|
752
|
+
else
|
|
753
|
+
return (0, import_babel.default)(opts);
|
|
754
|
+
}
|
|
755
|
+
});
|
|
732
756
|
try {
|
|
733
|
-
|
|
734
|
-
configFile: path5,
|
|
735
|
-
rcFile: false,
|
|
736
|
-
jitiOptions: {
|
|
737
|
-
cache: false,
|
|
738
|
-
// esmResolve: true,
|
|
739
|
-
// interopDefault: true,
|
|
740
|
-
alias: {
|
|
741
|
-
"webextension-polyfill": (0, import_path6.resolve)(
|
|
742
|
-
config.root,
|
|
743
|
-
"node_modules/wxt/dist/virtual-modules/fake-browser.js"
|
|
744
|
-
)
|
|
745
|
-
},
|
|
746
|
-
transform(opts) {
|
|
747
|
-
if (opts.filename === path5)
|
|
748
|
-
opts.source = transformedText;
|
|
749
|
-
opts.source = opts.source.replace(
|
|
750
|
-
/^import.*['"].*\.css['"];?$/gm,
|
|
751
|
-
""
|
|
752
|
-
);
|
|
753
|
-
return (0, import_babel.default)(opts);
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
return loaded.config;
|
|
757
|
+
return await jiti(path5);
|
|
758
758
|
} catch (err) {
|
|
759
|
-
|
|
759
|
+
config.logger.error(err);
|
|
760
760
|
throw err;
|
|
761
761
|
}
|
|
762
762
|
}
|
|
@@ -1731,7 +1731,7 @@ function reloadHtmlPages(groups, server, config) {
|
|
|
1731
1731
|
}
|
|
1732
1732
|
|
|
1733
1733
|
// package.json
|
|
1734
|
-
var version2 = "0.1.1-
|
|
1734
|
+
var version2 = "0.1.1-alpha4";
|
|
1735
1735
|
|
|
1736
1736
|
// src/core/utils/defineConfig.ts
|
|
1737
1737
|
function defineConfig(config) {
|
|
@@ -1774,7 +1774,7 @@ async function createServer2(config) {
|
|
|
1774
1774
|
const changes = detectDevChanges(fileChanges, server.currentOutput);
|
|
1775
1775
|
if (changes.type === "no-change")
|
|
1776
1776
|
return;
|
|
1777
|
-
|
|
1777
|
+
import_consola2.consola.info(
|
|
1778
1778
|
`Changed: ${Array.from(new Set(fileChanges.map((change) => change[1]))).map((file) => import_picocolors3.default.dim((0, import_node_path4.relative)(internalConfig.root, file))).join(", ")}`
|
|
1779
1779
|
);
|
|
1780
1780
|
const rebuiltNames = changes.rebuildGroups.flat().map((entry) => {
|
|
@@ -1802,7 +1802,7 @@ async function createServer2(config) {
|
|
|
1802
1802
|
reloadContentScripts(changes.changedSteps, internalConfig, server);
|
|
1803
1803
|
break;
|
|
1804
1804
|
}
|
|
1805
|
-
|
|
1805
|
+
import_consola2.consola.success(`Reloaded: ${rebuiltNames}`);
|
|
1806
1806
|
});
|
|
1807
1807
|
});
|
|
1808
1808
|
return server;
|