extension-create 4.0.32 → 4.0.34
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/module.cjs
CHANGED
|
@@ -439,10 +439,9 @@ async function generateExtensionTypes(projectPath, projectName, logger) {
|
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
const external_node_os_namespaceObject = require("node:os");
|
|
442
|
-
const external_adm_zip_namespaceObject = require("adm-zip");
|
|
443
|
-
var external_adm_zip_default = /*#__PURE__*/ __webpack_require__.n(external_adm_zip_namespaceObject);
|
|
444
442
|
const external_axios_namespaceObject = require("axios");
|
|
445
443
|
var external_axios_default = /*#__PURE__*/ __webpack_require__.n(external_axios_namespaceObject);
|
|
444
|
+
const external_fflate_namespaceObject = require("fflate");
|
|
446
445
|
const external_go_git_it_namespaceObject = require("go-git-it");
|
|
447
446
|
var external_go_git_it_default = /*#__PURE__*/ __webpack_require__.n(external_go_git_it_namespaceObject);
|
|
448
447
|
function _define_property(obj, key, value) {
|
|
@@ -455,6 +454,29 @@ function _define_property(obj, key, value) {
|
|
|
455
454
|
else obj[key] = value;
|
|
456
455
|
return obj;
|
|
457
456
|
}
|
|
457
|
+
async function extractZipBufferTo(zipBuffer, destinationDir) {
|
|
458
|
+
const root = external_node_path_namespaceObject.resolve(destinationDir);
|
|
459
|
+
const entries = (0, external_fflate_namespaceObject.unzipSync)(new Uint8Array(zipBuffer));
|
|
460
|
+
await promises_namespaceObject.mkdir(root, {
|
|
461
|
+
recursive: true
|
|
462
|
+
});
|
|
463
|
+
for (const [name, data] of Object.entries(entries)){
|
|
464
|
+
const normalized = name.replace(/\\/g, '/');
|
|
465
|
+
const target = external_node_path_namespaceObject.resolve(root, normalized);
|
|
466
|
+
const relative = external_node_path_namespaceObject.relative(root, target);
|
|
467
|
+
if (!relative || relative.startsWith('..') || external_node_path_namespaceObject.isAbsolute(relative)) throw new Error(`Refusing to extract zip entry outside the destination: ${name}`);
|
|
468
|
+
if (normalized.endsWith('/')) {
|
|
469
|
+
await promises_namespaceObject.mkdir(target, {
|
|
470
|
+
recursive: true
|
|
471
|
+
});
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
await promises_namespaceObject.mkdir(external_node_path_namespaceObject.dirname(target), {
|
|
475
|
+
recursive: true
|
|
476
|
+
});
|
|
477
|
+
await promises_namespaceObject.writeFile(target, data);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
458
480
|
const NETWORK_TIMEOUT_MS = (()=>{
|
|
459
481
|
const raw = parseInt(String(process.env.EXTENSION_CREATE_TIMEOUT_MS || ''), 10);
|
|
460
482
|
return Number.isFinite(raw) && raw > 0 ? raw : 60000;
|
|
@@ -519,22 +541,24 @@ async function downloadArchive(url, timeoutMs, attempts = 2) {
|
|
|
519
541
|
throw lastError;
|
|
520
542
|
}
|
|
521
543
|
async function extractExamplesTemplateFromZip(zipBuffer, templateName, projectPath) {
|
|
522
|
-
const
|
|
523
|
-
const entries = zip.getEntries();
|
|
544
|
+
const entries = Object.entries((0, external_fflate_namespaceObject.unzipSync)(new Uint8Array(zipBuffer)));
|
|
524
545
|
if (!entries.length) throw new TemplateNotFoundError(templateName, new Error('empty archive'));
|
|
525
|
-
const archiveRoot = entries[0].
|
|
546
|
+
const archiveRoot = entries[0][0].split('/')[0];
|
|
526
547
|
const wanted = `${archiveRoot}/examples/${templateName}/`;
|
|
527
|
-
const files = entries.filter((
|
|
548
|
+
const files = entries.filter(([name])=>!name.endsWith('/') && name.startsWith(wanted));
|
|
528
549
|
if (!files.length) throw new TemplateNotFoundError(templateName);
|
|
550
|
+
const root = external_node_path_namespaceObject.resolve(projectPath);
|
|
529
551
|
let written = 0;
|
|
530
|
-
for (const
|
|
531
|
-
const rel =
|
|
552
|
+
for (const [name, data] of files){
|
|
553
|
+
const rel = name.slice(wanted.length);
|
|
532
554
|
if (!rel) continue;
|
|
533
|
-
const dest = external_node_path_namespaceObject.
|
|
555
|
+
const dest = external_node_path_namespaceObject.resolve(root, rel);
|
|
556
|
+
const relative = external_node_path_namespaceObject.relative(root, dest);
|
|
557
|
+
if (!relative || relative.startsWith('..') || external_node_path_namespaceObject.isAbsolute(relative)) throw new Error(`Refusing to extract zip entry outside the destination: ${name}`);
|
|
534
558
|
await promises_namespaceObject.mkdir(external_node_path_namespaceObject.dirname(dest), {
|
|
535
559
|
recursive: true
|
|
536
560
|
});
|
|
537
|
-
await promises_namespaceObject.writeFile(dest,
|
|
561
|
+
await promises_namespaceObject.writeFile(dest, data);
|
|
538
562
|
written++;
|
|
539
563
|
}
|
|
540
564
|
return written;
|
|
@@ -738,8 +762,7 @@ async function importExternalTemplate(projectPath, projectName, template, logger
|
|
|
738
762
|
const contentType = String(headers?.['content-type'] || '');
|
|
739
763
|
const looksZip = /zip|octet-stream/i.test(contentType) || template.toLowerCase().endsWith('.zip');
|
|
740
764
|
if (!looksZip) throw new Error(`Remote template does not appear to be a ZIP archive: ${template}`);
|
|
741
|
-
|
|
742
|
-
zip.extractAllTo(tempPath, true);
|
|
765
|
+
await extractZipBufferTo(Buffer.from(data), tempPath);
|
|
743
766
|
const sourcePath = await getZipSourcePath(tempPath, template);
|
|
744
767
|
await moveDirectoryContents(sourcePath, projectPath);
|
|
745
768
|
provenance = {
|
|
@@ -865,134 +888,6 @@ async function initializeGitRepository(projectPath, projectName, templateName, l
|
|
|
865
888
|
], projectPath);
|
|
866
889
|
if (!committed.ok) logger.log(firstCommitSkipped(projectName, committed.reason || ''));
|
|
867
890
|
}
|
|
868
|
-
function buildExecEnv() {
|
|
869
|
-
if ('win32' !== process.platform) return;
|
|
870
|
-
const nodeDir = external_node_path_namespaceObject.dirname(process.execPath);
|
|
871
|
-
const pathSep = external_node_path_namespaceObject.delimiter;
|
|
872
|
-
const existing = process.env.PATH || process.env.Path || '';
|
|
873
|
-
if (existing.includes(nodeDir)) return;
|
|
874
|
-
return {
|
|
875
|
-
...process.env,
|
|
876
|
-
PATH: `${nodeDir}${pathSep}${existing}`.trim(),
|
|
877
|
-
Path: `${nodeDir}${pathSep}${existing}`.trim()
|
|
878
|
-
};
|
|
879
|
-
}
|
|
880
|
-
async function runInstall(command, args, opts) {
|
|
881
|
-
const env = buildExecEnv();
|
|
882
|
-
const child = (0, external_cross_spawn_namespaceObject.spawn)(command, args, {
|
|
883
|
-
stdio: opts.stdio,
|
|
884
|
-
cwd: opts.cwd,
|
|
885
|
-
env: env || process.env
|
|
886
|
-
});
|
|
887
|
-
let stdout = '';
|
|
888
|
-
let stderr = '';
|
|
889
|
-
if (child.stdout) child.stdout.on('data', (chunk)=>{
|
|
890
|
-
stdout += chunk.toString();
|
|
891
|
-
});
|
|
892
|
-
if (child.stderr) child.stderr.on('data', (chunk)=>{
|
|
893
|
-
stderr += chunk.toString();
|
|
894
|
-
});
|
|
895
|
-
return new Promise((resolve, reject)=>{
|
|
896
|
-
child.on('close', (code)=>{
|
|
897
|
-
resolve({
|
|
898
|
-
code,
|
|
899
|
-
stderr,
|
|
900
|
-
stdout
|
|
901
|
-
});
|
|
902
|
-
});
|
|
903
|
-
child.on('error', (error)=>{
|
|
904
|
-
reject(error);
|
|
905
|
-
});
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
function getInstallArgs(packageManager) {
|
|
909
|
-
if ('bun' === packageManager) return [
|
|
910
|
-
'install'
|
|
911
|
-
];
|
|
912
|
-
return [
|
|
913
|
-
'install',
|
|
914
|
-
'--silent'
|
|
915
|
-
];
|
|
916
|
-
}
|
|
917
|
-
function getTagFallback(version) {
|
|
918
|
-
if ('*' === version || 'latest' === version || 'next' === version) return null;
|
|
919
|
-
const cleaned = version.replace(/^[~^]/, '');
|
|
920
|
-
return cleaned.includes('-') ? 'next' : 'latest';
|
|
921
|
-
}
|
|
922
|
-
async function updateExtensionDependencyTag(projectPath, projectName, logger) {
|
|
923
|
-
const packageJsonPath = external_node_path_namespaceObject.join(projectPath, 'package.json');
|
|
924
|
-
try {
|
|
925
|
-
const raw = await external_node_fs_namespaceObject.promises.readFile(packageJsonPath, 'utf8');
|
|
926
|
-
const packageJson = JSON.parse(raw);
|
|
927
|
-
const currentVersion = packageJson?.devDependencies?.extension;
|
|
928
|
-
if ('string' != typeof currentVersion) return false;
|
|
929
|
-
const tag = getTagFallback(currentVersion);
|
|
930
|
-
if (!tag || currentVersion === tag) return false;
|
|
931
|
-
packageJson.devDependencies = {
|
|
932
|
-
...packageJson.devDependencies || {},
|
|
933
|
-
extension: tag
|
|
934
|
-
};
|
|
935
|
-
await external_node_fs_namespaceObject.promises.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
|
|
936
|
-
return true;
|
|
937
|
-
} catch (error) {
|
|
938
|
-
logger.error(cantInstallDependencies(projectName, error));
|
|
939
|
-
return false;
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
function shouldRetryWithTagFallback(output) {
|
|
943
|
-
const text = output.toLowerCase();
|
|
944
|
-
return text.includes('no matching version found for extension@') || text.includes('notarget') || text.includes('etarget');
|
|
945
|
-
}
|
|
946
|
-
async function install_dependencies_runInstall(command, args, cwd, stdio) {
|
|
947
|
-
return runInstall(command, args, {
|
|
948
|
-
cwd,
|
|
949
|
-
stdio
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
async function hasDependenciesToInstall(projectPath) {
|
|
953
|
-
try {
|
|
954
|
-
const raw = await external_node_fs_namespaceObject.promises.readFile(external_node_path_namespaceObject.join(projectPath, 'package.json'), 'utf8');
|
|
955
|
-
const packageJson = JSON.parse(raw);
|
|
956
|
-
const depsCount = Object.keys(packageJson?.dependencies || {}).length;
|
|
957
|
-
const devDepsCount = Object.keys(packageJson?.devDependencies || {}).length;
|
|
958
|
-
return depsCount + devDepsCount > 0;
|
|
959
|
-
} catch (error) {
|
|
960
|
-
return true;
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
async function installDependencies(projectPath, projectName, logger) {
|
|
964
|
-
const nodeModulesPath = external_node_path_namespaceObject.join(projectPath, 'node_modules');
|
|
965
|
-
const shouldInstall = await hasDependenciesToInstall(projectPath);
|
|
966
|
-
if (!shouldInstall) return;
|
|
967
|
-
const command = isDenoRuntime() ? 'deno' : await getInstallCommand();
|
|
968
|
-
const dependenciesArgs = 'deno' === command ? [
|
|
969
|
-
'install'
|
|
970
|
-
] : getInstallArgs(command);
|
|
971
|
-
const installMessage = installingDependencies();
|
|
972
|
-
logger.log(installMessage);
|
|
973
|
-
try {
|
|
974
|
-
await external_node_fs_namespaceObject.promises.mkdir(nodeModulesPath, {
|
|
975
|
-
recursive: true
|
|
976
|
-
});
|
|
977
|
-
const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'pipe';
|
|
978
|
-
const firstRun = await install_dependencies_runInstall(command, dependenciesArgs, projectPath, stdio);
|
|
979
|
-
if (0 !== firstRun.code) {
|
|
980
|
-
const output = `${firstRun.stdout}\n${firstRun.stderr}`;
|
|
981
|
-
const shouldRetry = shouldRetryWithTagFallback(output);
|
|
982
|
-
const didUpdate = shouldRetry ? await updateExtensionDependencyTag(projectPath, projectName, logger) : false;
|
|
983
|
-
if (didUpdate) {
|
|
984
|
-
const retryRun = await install_dependencies_runInstall(command, dependenciesArgs, projectPath, stdio);
|
|
985
|
-
if (0 === retryRun.code) return;
|
|
986
|
-
}
|
|
987
|
-
throw new Error(installingDependenciesFailed(command, dependenciesArgs, firstRun.code));
|
|
988
|
-
}
|
|
989
|
-
} catch (error) {
|
|
990
|
-
logger.error(installingDependenciesProcessError(projectName, error));
|
|
991
|
-
logger.error(cantInstallDependencies(projectName, error));
|
|
992
|
-
throw error;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
const external_node_module_namespaceObject = require("node:module");
|
|
996
891
|
function stripJsoncExtensions(text) {
|
|
997
892
|
let out = '';
|
|
998
893
|
let i = 0;
|
|
@@ -1107,6 +1002,200 @@ function readDenoConfigDependencies(projectPath) {
|
|
|
1107
1002
|
}
|
|
1108
1003
|
return dependencies;
|
|
1109
1004
|
}
|
|
1005
|
+
function buildExecEnv() {
|
|
1006
|
+
if ('win32' !== process.platform) return;
|
|
1007
|
+
const nodeDir = external_node_path_namespaceObject.dirname(process.execPath);
|
|
1008
|
+
const pathSep = external_node_path_namespaceObject.delimiter;
|
|
1009
|
+
const existing = process.env.PATH || process.env.Path || '';
|
|
1010
|
+
if (existing.includes(nodeDir)) return;
|
|
1011
|
+
return {
|
|
1012
|
+
...process.env,
|
|
1013
|
+
PATH: `${nodeDir}${pathSep}${existing}`.trim(),
|
|
1014
|
+
Path: `${nodeDir}${pathSep}${existing}`.trim()
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
async function runInstall(command, args, opts) {
|
|
1018
|
+
const env = buildExecEnv();
|
|
1019
|
+
const child = (0, external_cross_spawn_namespaceObject.spawn)(command, args, {
|
|
1020
|
+
stdio: opts.stdio,
|
|
1021
|
+
cwd: opts.cwd,
|
|
1022
|
+
env: env || process.env
|
|
1023
|
+
});
|
|
1024
|
+
let stdout = '';
|
|
1025
|
+
let stderr = '';
|
|
1026
|
+
if (child.stdout) child.stdout.on('data', (chunk)=>{
|
|
1027
|
+
stdout += chunk.toString();
|
|
1028
|
+
});
|
|
1029
|
+
if (child.stderr) child.stderr.on('data', (chunk)=>{
|
|
1030
|
+
stderr += chunk.toString();
|
|
1031
|
+
});
|
|
1032
|
+
return new Promise((resolve, reject)=>{
|
|
1033
|
+
child.on('close', (code)=>{
|
|
1034
|
+
resolve({
|
|
1035
|
+
code,
|
|
1036
|
+
stderr,
|
|
1037
|
+
stdout
|
|
1038
|
+
});
|
|
1039
|
+
});
|
|
1040
|
+
child.on('error', (error)=>{
|
|
1041
|
+
reject(error);
|
|
1042
|
+
});
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
function getInstallArgs(packageManager) {
|
|
1046
|
+
if ('bun' === packageManager) return [
|
|
1047
|
+
'install'
|
|
1048
|
+
];
|
|
1049
|
+
return [
|
|
1050
|
+
'install',
|
|
1051
|
+
'--silent'
|
|
1052
|
+
];
|
|
1053
|
+
}
|
|
1054
|
+
function getTagFallback(version) {
|
|
1055
|
+
if ('*' === version || 'latest' === version || 'next' === version) return null;
|
|
1056
|
+
const cleaned = version.replace(/^[~^]/, '');
|
|
1057
|
+
return cleaned.includes('-') ? 'next' : 'latest';
|
|
1058
|
+
}
|
|
1059
|
+
async function pathExists(target) {
|
|
1060
|
+
try {
|
|
1061
|
+
await external_node_fs_namespaceObject.promises.access(target);
|
|
1062
|
+
return true;
|
|
1063
|
+
} catch {
|
|
1064
|
+
return false;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
async function resolveDenoConfigPath(projectPath) {
|
|
1068
|
+
for (const candidate of [
|
|
1069
|
+
'deno.json',
|
|
1070
|
+
'deno.jsonc'
|
|
1071
|
+
]){
|
|
1072
|
+
const full = external_node_path_namespaceObject.join(projectPath, candidate);
|
|
1073
|
+
if (await pathExists(full)) return full;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
async function updatePackageJsonExtensionTag(projectPath) {
|
|
1077
|
+
const packageJsonPath = external_node_path_namespaceObject.join(projectPath, 'package.json');
|
|
1078
|
+
if (!await pathExists(packageJsonPath)) return false;
|
|
1079
|
+
const packageJson = JSON.parse(await external_node_fs_namespaceObject.promises.readFile(packageJsonPath, 'utf8'));
|
|
1080
|
+
const currentVersion = packageJson?.devDependencies?.extension;
|
|
1081
|
+
if ('string' != typeof currentVersion) return false;
|
|
1082
|
+
const tag = getTagFallback(currentVersion);
|
|
1083
|
+
if (!tag || currentVersion === tag) return false;
|
|
1084
|
+
packageJson.devDependencies = {
|
|
1085
|
+
...packageJson.devDependencies || {},
|
|
1086
|
+
extension: tag
|
|
1087
|
+
};
|
|
1088
|
+
await external_node_fs_namespaceObject.promises.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
|
|
1089
|
+
return true;
|
|
1090
|
+
}
|
|
1091
|
+
function replaceExtensionSpecifierInDenoConfig(raw, currentSpecifier, nextSpecifier) {
|
|
1092
|
+
if (currentSpecifier === nextSpecifier) return;
|
|
1093
|
+
const quoted = `"${currentSpecifier}"`;
|
|
1094
|
+
let from = 0;
|
|
1095
|
+
while(from < raw.length){
|
|
1096
|
+
const at = raw.indexOf(quoted, from);
|
|
1097
|
+
if (-1 === at) break;
|
|
1098
|
+
const lineStart = raw.lastIndexOf('\n', at) + 1;
|
|
1099
|
+
const lineBefore = raw.slice(lineStart, at);
|
|
1100
|
+
if (/:\s*$/.test(lineBefore) && !lineBefore.includes('//')) {
|
|
1101
|
+
const index = at + 1;
|
|
1102
|
+
return raw.slice(0, index) + nextSpecifier + raw.slice(index + currentSpecifier.length);
|
|
1103
|
+
}
|
|
1104
|
+
from = at + quoted.length;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
async function updateDenoConfigExtensionTag(projectPath) {
|
|
1108
|
+
const configPath = await resolveDenoConfigPath(projectPath);
|
|
1109
|
+
if (!configPath) return false;
|
|
1110
|
+
const raw = await external_node_fs_namespaceObject.promises.readFile(configPath, 'utf8');
|
|
1111
|
+
const config = parseJsoncSafe(raw);
|
|
1112
|
+
const imports = config?.imports;
|
|
1113
|
+
if (!imports || 'object' != typeof imports) return false;
|
|
1114
|
+
let next = raw;
|
|
1115
|
+
let updated = false;
|
|
1116
|
+
for (const specifier of Object.values(imports)){
|
|
1117
|
+
if ('string' != typeof specifier) continue;
|
|
1118
|
+
const parsed = parseNpmSpecifier(specifier);
|
|
1119
|
+
if (!parsed || 'extension' !== parsed.name) continue;
|
|
1120
|
+
const tag = getTagFallback(parsed.version);
|
|
1121
|
+
if (!tag || parsed.version === tag) continue;
|
|
1122
|
+
const rewritten = replaceExtensionSpecifierInDenoConfig(next, specifier, `npm:extension@${tag}`);
|
|
1123
|
+
if (void 0 !== rewritten) {
|
|
1124
|
+
next = rewritten;
|
|
1125
|
+
updated = true;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
if (!updated) return false;
|
|
1129
|
+
await external_node_fs_namespaceObject.promises.writeFile(configPath, next);
|
|
1130
|
+
return true;
|
|
1131
|
+
}
|
|
1132
|
+
async function updateExtensionDependencyTag(projectPath, projectName, logger) {
|
|
1133
|
+
try {
|
|
1134
|
+
const updatedPackageJson = await updatePackageJsonExtensionTag(projectPath);
|
|
1135
|
+
const updatedDenoConfig = await updateDenoConfigExtensionTag(projectPath);
|
|
1136
|
+
return updatedPackageJson || updatedDenoConfig;
|
|
1137
|
+
} catch (error) {
|
|
1138
|
+
logger.error(cantInstallDependencies(projectName, error));
|
|
1139
|
+
return false;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
function shouldRetryWithTagFallback(output) {
|
|
1143
|
+
const text = output.toLowerCase();
|
|
1144
|
+
return text.includes('no matching version found for extension@') || text.includes('notarget') && text.includes('extension@') || text.includes('etarget') && text.includes('extension@') || /could not find version of npm package ['"]?extension['"]?/.test(text);
|
|
1145
|
+
}
|
|
1146
|
+
async function install_dependencies_runInstall(command, args, cwd, stdio) {
|
|
1147
|
+
return runInstall(command, args, {
|
|
1148
|
+
cwd,
|
|
1149
|
+
stdio
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
async function hasDependenciesToInstall(projectPath) {
|
|
1153
|
+
const packageJsonPath = external_node_path_namespaceObject.join(projectPath, 'package.json');
|
|
1154
|
+
let raw;
|
|
1155
|
+
try {
|
|
1156
|
+
raw = await external_node_fs_namespaceObject.promises.readFile(packageJsonPath, 'utf8');
|
|
1157
|
+
} catch (error) {
|
|
1158
|
+
if (error?.code === 'ENOENT') return Object.keys(readDenoConfigDependencies(projectPath)).length > 0;
|
|
1159
|
+
throw error;
|
|
1160
|
+
}
|
|
1161
|
+
const packageJson = JSON.parse(raw);
|
|
1162
|
+
const depsCount = Object.keys(packageJson?.dependencies || {}).length;
|
|
1163
|
+
const devDepsCount = Object.keys(packageJson?.devDependencies || {}).length;
|
|
1164
|
+
return depsCount + devDepsCount > 0;
|
|
1165
|
+
}
|
|
1166
|
+
async function installDependencies(projectPath, projectName, logger) {
|
|
1167
|
+
const nodeModulesPath = external_node_path_namespaceObject.join(projectPath, 'node_modules');
|
|
1168
|
+
const shouldInstall = await hasDependenciesToInstall(projectPath);
|
|
1169
|
+
if (!shouldInstall) return;
|
|
1170
|
+
const command = isDenoRuntime() ? 'deno' : await getInstallCommand();
|
|
1171
|
+
const dependenciesArgs = 'deno' === command ? [
|
|
1172
|
+
'install'
|
|
1173
|
+
] : getInstallArgs(command);
|
|
1174
|
+
const installMessage = installingDependencies();
|
|
1175
|
+
logger.log(installMessage);
|
|
1176
|
+
try {
|
|
1177
|
+
await external_node_fs_namespaceObject.promises.mkdir(nodeModulesPath, {
|
|
1178
|
+
recursive: true
|
|
1179
|
+
});
|
|
1180
|
+
const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'pipe';
|
|
1181
|
+
const firstRun = await install_dependencies_runInstall(command, dependenciesArgs, projectPath, stdio);
|
|
1182
|
+
if (0 !== firstRun.code) {
|
|
1183
|
+
const output = `${firstRun.stdout}\n${firstRun.stderr}`;
|
|
1184
|
+
const shouldRetry = shouldRetryWithTagFallback(output);
|
|
1185
|
+
const didUpdate = shouldRetry ? await updateExtensionDependencyTag(projectPath, projectName, logger) : false;
|
|
1186
|
+
if (didUpdate) {
|
|
1187
|
+
const retryRun = await install_dependencies_runInstall(command, dependenciesArgs, projectPath, stdio);
|
|
1188
|
+
if (0 === retryRun.code) return;
|
|
1189
|
+
}
|
|
1190
|
+
throw new Error(installingDependenciesFailed(command, dependenciesArgs, firstRun.code));
|
|
1191
|
+
}
|
|
1192
|
+
} catch (error) {
|
|
1193
|
+
logger.error(installingDependenciesProcessError(projectName, error));
|
|
1194
|
+
logger.error(cantInstallDependencies(projectName, error));
|
|
1195
|
+
throw error;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
const external_node_module_namespaceObject = require("node:module");
|
|
1110
1199
|
const requireFromCreate = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
1111
1200
|
function resolveDevelopRoot(projectPath) {
|
|
1112
1201
|
try {
|
|
@@ -1488,7 +1577,7 @@ async function overridePackageJson(projectPath, { template = "javascript", cliVe
|
|
|
1488
1577
|
throw error;
|
|
1489
1578
|
}
|
|
1490
1579
|
}
|
|
1491
|
-
async function
|
|
1580
|
+
async function write_deno_jsonc_pathExists(target) {
|
|
1492
1581
|
try {
|
|
1493
1582
|
await promises_namespaceObject.access(target);
|
|
1494
1583
|
return true;
|
|
@@ -1534,7 +1623,7 @@ async function writeDenoJsonc(projectPath, { template = "javascript", cliVersion
|
|
|
1534
1623
|
for (const candidate of [
|
|
1535
1624
|
'deno.json',
|
|
1536
1625
|
'deno.jsonc'
|
|
1537
|
-
])if (await
|
|
1626
|
+
])if (await write_deno_jsonc_pathExists(external_node_path_namespaceObject.join(projectPath, candidate))) {
|
|
1538
1627
|
existingConfig = candidate;
|
|
1539
1628
|
break;
|
|
1540
1629
|
}
|
|
@@ -1551,8 +1640,12 @@ async function writeDenoJsonc(projectPath, { template = "javascript", cliVersion
|
|
|
1551
1640
|
...imports || {},
|
|
1552
1641
|
...config.imports || {}
|
|
1553
1642
|
};
|
|
1554
|
-
if (
|
|
1555
|
-
|
|
1643
|
+
if (imports?.extension) config.imports.extension = imports.extension;
|
|
1644
|
+
config.nodeModulesDir = 'auto';
|
|
1645
|
+
config.tasks = {
|
|
1646
|
+
...tasks,
|
|
1647
|
+
...config.tasks || {}
|
|
1648
|
+
};
|
|
1556
1649
|
await promises_namespaceObject.writeFile(configPath, `${JSON.stringify(config, null, 2)}\n`);
|
|
1557
1650
|
} else await promises_namespaceObject.writeFile(external_node_path_namespaceObject.join(projectPath, 'deno.jsonc'), renderDenoJsonc(tasks, imports));
|
|
1558
1651
|
if (primary) await promises_namespaceObject.rm(external_node_path_namespaceObject.join(projectPath, 'package.json'), {
|
|
@@ -9,7 +9,7 @@ Packaging your extension is local and free. Submitting the result to a
|
|
|
9
9
|
store is what [extension.dev](https://docs.extension.dev/publish/overview?utm_source=store-md)
|
|
10
10
|
does, and it sponsors Extension.js.
|
|
11
11
|
|
|
12
|
-
Last updated: 2026-08-
|
|
12
|
+
Last updated: 2026-08-18
|
|
13
13
|
|
|
14
14
|
## Listing
|
|
15
15
|
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"templates"
|
|
26
26
|
],
|
|
27
27
|
"name": "extension-create",
|
|
28
|
-
"version": "4.0.
|
|
28
|
+
"version": "4.0.34",
|
|
29
29
|
"description": "The standalone extension creation engine for Extension.js",
|
|
30
30
|
"author": {
|
|
31
31
|
"name": "Cezar Augusto",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"edge-extension"
|
|
76
76
|
],
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"adm-zip": "^0.6.0",
|
|
79
78
|
"axios": "^1.18.0",
|
|
80
79
|
"cross-spawn": "^7.0.6",
|
|
80
|
+
"fflate": "^0.8.3",
|
|
81
81
|
"go-git-it": "^5.1.5",
|
|
82
82
|
"pintor": "0.3.0",
|
|
83
83
|
"prefers-yarn": "2.0.1"
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
"@biomejs/biome": "^2.2.4",
|
|
87
87
|
"@changesets/cli": "^2.29.8",
|
|
88
88
|
"@rslib/core": "^0.23.1",
|
|
89
|
-
"@types/adm-zip": "^0.5.7",
|
|
90
89
|
"@types/chrome": "^0.1.33",
|
|
91
90
|
"@types/cross-spawn": "^6.0.6",
|
|
92
91
|
"@types/node": "^26",
|