extension 3.0.0-next.55 → 3.0.0-next.57
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.js +35 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -23,7 +23,7 @@ var __webpack_require__ = {};
|
|
|
23
23
|
})();
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
const external_commander_namespaceObject = require("commander");
|
|
26
|
-
var package_namespaceObject = JSON.parse('{"license":"MIT","repository":{"type":"git","url":"git+https://github.com/extension-js/extension.js.git","directory":"programs/cli"},"engines":{"node":">=18"},"exports":{".":{"types":"./dist/cli.d.ts","import":"./dist/cli.js","require":"./dist/cli.js"}},"main":"./dist/cli.js","types":"./dist/cli.d.ts","typesVersions":{"*":{"types":["./types/index.d.ts"],"types/*":["./types/*"]}},"files":["dist","types"],"bin":{"extension":"./dist/cli.js"},"name":"extension","version":"3.0.0-next.
|
|
26
|
+
var package_namespaceObject = JSON.parse('{"license":"MIT","repository":{"type":"git","url":"git+https://github.com/extension-js/extension.js.git","directory":"programs/cli"},"engines":{"node":">=18"},"exports":{".":{"types":"./dist/cli.d.ts","import":"./dist/cli.js","require":"./dist/cli.js"}},"main":"./dist/cli.js","types":"./dist/cli.d.ts","typesVersions":{"*":{"types":["./types/index.d.ts"],"types/*":["./types/*"]}},"files":["dist","types"],"bin":{"extension":"./dist/cli.js"},"name":"extension","version":"3.0.0-next.57","description":"Create cross-browser extensions with no build configuration.","homepage":"https://extension.js.org/","author":{"name":"Cezar Augusto","email":"boss@cezaraugusto.net","url":"https://cezaraugusto.com"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"prepublishOnly":"pnpm run compile","compile":"rslib build","watch":"rslib build --watch","test":"vitest run"},"keywords":["zero-config","build","develop","browser","extension","chrome extension","edge extension","firefox extension","safari extension","web","react","typescript","webextension","browser-extension","chrome-extension","firefox-addon","edge-extension","safari-web-extension","manifest-v3","mv3","cross-browser","content-script","background-script","devtools","create-extension","scaffold","starter-template","boilerplate","cli"],"dependencies":{"commander":"^12.1.0","extension-create":"^2.2.0","pintor":"0.3.0","semver":"^7.6.3","update-check":"^1.5.4"},"devDependencies":{"@rslib/core":"^0.6.9","@types/chrome":"^0.0.287","@types/node":"^22.10.1","@types/react":"^19.0.1","@types/react-dom":"^19.0.1","@types/webextension-polyfill":"0.12.3","@types/mock-fs":"^4.13.4","@types/semver":"^7.5.8","mock-fs":"^5.4.1","webextension-polyfill":"^0.12.0","tsconfig":"*","typescript":"5.7.2","vitest":"^3.2.4"}}');
|
|
27
27
|
const external_update_check_namespaceObject = require("update-check");
|
|
28
28
|
var external_update_check_default = /*#__PURE__*/ __webpack_require__.n(external_update_check_namespaceObject);
|
|
29
29
|
const external_pintor_namespaceObject = require("pintor");
|
|
@@ -503,6 +503,16 @@ if (!telemetryDisabled) {
|
|
|
503
503
|
const external_extension_create_namespaceObject = require("extension-create");
|
|
504
504
|
const external_node_child_process_namespaceObject = require("node:child_process");
|
|
505
505
|
const external_node_url_namespaceObject = require("node:url");
|
|
506
|
+
function copyIfExists(src, dest) {
|
|
507
|
+
try {
|
|
508
|
+
if (external_node_fs_default().existsSync(src)) external_node_fs_default().copyFileSync(src, dest);
|
|
509
|
+
} catch {}
|
|
510
|
+
}
|
|
511
|
+
function syncPackageManagerConfig(cacheDir) {
|
|
512
|
+
const cwd = process.cwd();
|
|
513
|
+
copyIfExists(external_node_path_default().join(cwd, '.npmrc'), external_node_path_default().join(cacheDir, '.npmrc'));
|
|
514
|
+
copyIfExists(external_node_path_default().join(cwd, '.pnpmfile.cjs'), external_node_path_default().join(cacheDir, '.pnpmfile.cjs'));
|
|
515
|
+
}
|
|
506
516
|
function resolveModuleEntry(modulePath, pkgJson) {
|
|
507
517
|
const exportsField = pkgJson.exports;
|
|
508
518
|
let main = pkgJson.main;
|
|
@@ -541,6 +551,7 @@ async function requireOrDlx(moduleName, versionHint) {
|
|
|
541
551
|
const spec = versionHint ? `${moduleName}@${versionHint}` : moduleName;
|
|
542
552
|
const cacheDir = external_node_path_default().join(external_node_os_default().tmpdir(), 'extensionjs-cache', spec);
|
|
543
553
|
const modulePath = external_node_path_default().join(cacheDir, 'node_modules', moduleName);
|
|
554
|
+
const pkgJsonPath = external_node_path_default().join(modulePath, 'package.json');
|
|
544
555
|
try {
|
|
545
556
|
const localDist = external_node_path_default().resolve(__dirname, '..', '..', 'develop', 'dist', 'module.js');
|
|
546
557
|
if (external_node_fs_default().existsSync(localDist)) return await import((0, external_node_url_namespaceObject.pathToFileURL)(localDist).href);
|
|
@@ -567,9 +578,10 @@ async function requireOrDlx(moduleName, versionHint) {
|
|
|
567
578
|
recursive: true
|
|
568
579
|
});
|
|
569
580
|
} catch {}
|
|
581
|
+
syncPackageManagerConfig(cacheDir);
|
|
570
582
|
let preInstallPkgJson;
|
|
571
583
|
try {
|
|
572
|
-
preInstallPkgJson = JSON.parse(external_node_fs_default().readFileSync(
|
|
584
|
+
preInstallPkgJson = JSON.parse(external_node_fs_default().readFileSync(pkgJsonPath, 'utf8'));
|
|
573
585
|
} catch {}
|
|
574
586
|
if (preInstallPkgJson) {
|
|
575
587
|
const entry = resolveModuleEntry(modulePath, preInstallPkgJson);
|
|
@@ -652,8 +664,28 @@ async function requireOrDlx(moduleName, versionHint) {
|
|
|
652
664
|
}
|
|
653
665
|
if (0 !== status) throw new Error(`Failed to install ${spec}`);
|
|
654
666
|
let postInstallPkgJson;
|
|
667
|
+
if (!external_node_fs_default().existsSync(pkgJsonPath)) try {
|
|
668
|
+
const args = [
|
|
669
|
+
'i',
|
|
670
|
+
spec,
|
|
671
|
+
'--no-fund',
|
|
672
|
+
'--no-audit',
|
|
673
|
+
'--prefer-online',
|
|
674
|
+
'--omit=dev',
|
|
675
|
+
'--omit=optional',
|
|
676
|
+
'--no-package-lock'
|
|
677
|
+
];
|
|
678
|
+
const npmStatus = (0, external_node_child_process_namespaceObject.spawnSync)(isWin ? 'npm.cmd' : 'npm', args, {
|
|
679
|
+
cwd: cacheDir,
|
|
680
|
+
stdio: 'ignore'
|
|
681
|
+
}).status || 0;
|
|
682
|
+
if (0 !== npmStatus || !external_node_fs_default().existsSync(pkgJsonPath)) throw new Error(`Failed to install ${spec}: package.json not found at ${pkgJsonPath}. If you use a custom registry or auth, ensure your npm/pnpm config is visible to the Extension.js CLI.`);
|
|
683
|
+
} catch (err) {
|
|
684
|
+
if (err instanceof Error) throw err;
|
|
685
|
+
throw new Error(`Failed to install ${spec}: package.json not found at ${pkgJsonPath}. If you use a custom registry or auth, ensure your npm/pnpm config is visible to the Extension.js CLI.`);
|
|
686
|
+
}
|
|
655
687
|
try {
|
|
656
|
-
postInstallPkgJson = JSON.parse(external_node_fs_default().readFileSync(
|
|
688
|
+
postInstallPkgJson = JSON.parse(external_node_fs_default().readFileSync(pkgJsonPath, 'utf8'));
|
|
657
689
|
} catch {}
|
|
658
690
|
if (postInstallPkgJson) {
|
|
659
691
|
const entry = resolveModuleEntry(modulePath, postInstallPkgJson);
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"extension": "./dist/cli.js"
|
|
36
36
|
},
|
|
37
37
|
"name": "extension",
|
|
38
|
-
"version": "3.0.0-next.
|
|
38
|
+
"version": "3.0.0-next.57",
|
|
39
39
|
"description": "Create cross-browser extensions with no build configuration.",
|
|
40
40
|
"homepage": "https://extension.js.org/",
|
|
41
41
|
"author": {
|