@pubm/core 0.5.1 → 0.5.2
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/config/defaults.d.ts.map +1 -1
- package/dist/config/types.d.ts +14 -2
- package/dist/config/types.d.ts.map +1 -1
- package/dist/ecosystem/ecosystem.d.ts +9 -2
- package/dist/ecosystem/ecosystem.d.ts.map +1 -1
- package/dist/ecosystem/js.d.ts +9 -2
- package/dist/ecosystem/js.d.ts.map +1 -1
- package/dist/ecosystem/rust.d.ts +9 -2
- package/dist/ecosystem/rust.d.ts.map +1 -1
- package/dist/index.cjs +435 -220
- package/dist/index.js +415 -200
- package/dist/tasks/phases/test-build.d.ts.map +1 -1
- package/dist/tasks/required-conditions-check.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17641,7 +17641,7 @@ var package_default;
|
|
|
17641
17641
|
var init_package = __esm(() => {
|
|
17642
17642
|
package_default = {
|
|
17643
17643
|
name: "@pubm/core",
|
|
17644
|
-
version: "0.5.
|
|
17644
|
+
version: "0.5.2",
|
|
17645
17645
|
type: "module",
|
|
17646
17646
|
description: "Core SDK for pubm - publish manager for multiple registries",
|
|
17647
17647
|
types: "./dist/index.d.ts",
|
|
@@ -17720,7 +17720,7 @@ var coreEngines, PUBM_VERSION, PUBM_ENGINES;
|
|
|
17720
17720
|
var init_pubm_metadata = __esm(() => {
|
|
17721
17721
|
init_package();
|
|
17722
17722
|
coreEngines = package_default.engines ?? {};
|
|
17723
|
-
PUBM_VERSION = resolveDefine("0.5.
|
|
17723
|
+
PUBM_VERSION = resolveDefine("0.5.2", package_default.version);
|
|
17724
17724
|
PUBM_ENGINES = {
|
|
17725
17725
|
node: resolveDefine(">=24", coreEngines.node ?? ">=18"),
|
|
17726
17726
|
git: resolveDefine(">=2.11.0", coreEngines.git ?? ">=2.11.0"),
|
|
@@ -22097,11 +22097,16 @@ var init_rust = __esm(() => {
|
|
|
22097
22097
|
manifestFiles() {
|
|
22098
22098
|
return ["Cargo.toml"];
|
|
22099
22099
|
}
|
|
22100
|
-
|
|
22101
|
-
|
|
22100
|
+
resolveTestCommand(script) {
|
|
22101
|
+
const parts = script.split(/\s+/);
|
|
22102
|
+
return Promise.resolve({ cmd: "cargo", args: parts });
|
|
22102
22103
|
}
|
|
22103
|
-
|
|
22104
|
-
|
|
22104
|
+
resolveBuildCommand(script) {
|
|
22105
|
+
const parts = script.split(/\s+/);
|
|
22106
|
+
return Promise.resolve({ cmd: "cargo", args: parts });
|
|
22107
|
+
}
|
|
22108
|
+
validateScript(_script, _type) {
|
|
22109
|
+
return Promise.resolve(null);
|
|
22105
22110
|
}
|
|
22106
22111
|
supportedRegistries() {
|
|
22107
22112
|
return ["crates"];
|
|
@@ -23636,13 +23641,26 @@ var init_js = __esm(() => {
|
|
|
23636
23641
|
manifestFiles() {
|
|
23637
23642
|
return ["package.json"];
|
|
23638
23643
|
}
|
|
23639
|
-
async
|
|
23644
|
+
async resolveTestCommand(script) {
|
|
23640
23645
|
const pm = await getPackageManager();
|
|
23641
|
-
return
|
|
23646
|
+
return { cmd: pm, args: ["run", script] };
|
|
23642
23647
|
}
|
|
23643
|
-
async
|
|
23648
|
+
async resolveBuildCommand(script) {
|
|
23644
23649
|
const pm = await getPackageManager();
|
|
23645
|
-
return
|
|
23650
|
+
return { cmd: pm, args: ["run", script] };
|
|
23651
|
+
}
|
|
23652
|
+
async validateScript(script, _type) {
|
|
23653
|
+
const pkgPath = import_node_path8.default.join(this.packagePath, "package.json");
|
|
23654
|
+
try {
|
|
23655
|
+
const raw = await import_promises6.readFile(pkgPath, "utf-8");
|
|
23656
|
+
const { scripts } = JSON.parse(raw);
|
|
23657
|
+
if (!scripts?.[script]) {
|
|
23658
|
+
return `Script '${script}' not found in ${pkgPath}`;
|
|
23659
|
+
}
|
|
23660
|
+
return null;
|
|
23661
|
+
} catch {
|
|
23662
|
+
return `Cannot read ${pkgPath}`;
|
|
23663
|
+
}
|
|
23646
23664
|
}
|
|
23647
23665
|
supportedRegistries() {
|
|
23648
23666
|
return ["npm", "jsr"];
|
|
@@ -23783,13 +23801,6 @@ var init_catalog2 = __esm(() => {
|
|
|
23783
23801
|
init_js();
|
|
23784
23802
|
init_rust();
|
|
23785
23803
|
ecosystemCatalog = new EcosystemCatalog;
|
|
23786
|
-
ecosystemCatalog.register({
|
|
23787
|
-
key: "js",
|
|
23788
|
-
label: "JavaScript",
|
|
23789
|
-
defaultRegistries: ["npm", "jsr"],
|
|
23790
|
-
ecosystemClass: JsEcosystem,
|
|
23791
|
-
detect: (path6) => JsEcosystem.detect(path6)
|
|
23792
|
-
});
|
|
23793
23804
|
ecosystemCatalog.register({
|
|
23794
23805
|
key: "rust",
|
|
23795
23806
|
label: "Rust",
|
|
@@ -23797,6 +23808,13 @@ var init_catalog2 = __esm(() => {
|
|
|
23797
23808
|
ecosystemClass: RustEcosystem,
|
|
23798
23809
|
detect: (path6) => RustEcosystem.detect(path6)
|
|
23799
23810
|
});
|
|
23811
|
+
ecosystemCatalog.register({
|
|
23812
|
+
key: "js",
|
|
23813
|
+
label: "JavaScript",
|
|
23814
|
+
defaultRegistries: ["npm", "jsr"],
|
|
23815
|
+
ecosystemClass: JsEcosystem,
|
|
23816
|
+
detect: (path6) => JsEcosystem.detect(path6)
|
|
23817
|
+
});
|
|
23800
23818
|
});
|
|
23801
23819
|
|
|
23802
23820
|
// src/plugin/runner.ts
|
|
@@ -35657,8 +35675,8 @@ var prerequisitesCheckTask = (options) => {
|
|
|
35657
35675
|
};
|
|
35658
35676
|
|
|
35659
35677
|
// src/tasks/required-conditions-check.ts
|
|
35660
|
-
var
|
|
35661
|
-
|
|
35678
|
+
var import_node_path21 = __toESM(require("node:path"));
|
|
35679
|
+
init_catalog2();
|
|
35662
35680
|
init_error4();
|
|
35663
35681
|
init_git();
|
|
35664
35682
|
init_i18n();
|
|
@@ -35746,20 +35764,66 @@ var requiredConditionsCheckTask = (options) => {
|
|
|
35746
35764
|
},
|
|
35747
35765
|
{
|
|
35748
35766
|
title: t("task.conditions.checkScripts"),
|
|
35749
|
-
skip: (ctx2) =>
|
|
35767
|
+
skip: (ctx2) => !!ctx2.options.skipTests && !!ctx2.options.skipBuild,
|
|
35750
35768
|
task: async (ctx2) => {
|
|
35751
|
-
const raw = await import_promises8.readFile(import_node_path21.join(ctx2.cwd, "package.json"), "utf-8");
|
|
35752
|
-
const { scripts } = JSON.parse(raw);
|
|
35753
35769
|
const errors = [];
|
|
35754
|
-
|
|
35755
|
-
|
|
35756
|
-
|
|
35757
|
-
|
|
35770
|
+
const JS_WS_TYPES = new Set([
|
|
35771
|
+
"pnpm",
|
|
35772
|
+
"npm",
|
|
35773
|
+
"yarn",
|
|
35774
|
+
"bun",
|
|
35775
|
+
"deno"
|
|
35776
|
+
]);
|
|
35777
|
+
const workspaces = detectWorkspace(ctx2.cwd);
|
|
35778
|
+
const byEcosystem = new Map;
|
|
35779
|
+
for (const pkg of ctx2.config.packages) {
|
|
35780
|
+
const key = pkg.ecosystem ?? "js";
|
|
35781
|
+
if (!byEcosystem.has(key))
|
|
35782
|
+
byEcosystem.set(key, []);
|
|
35783
|
+
byEcosystem.get(key).push(pkg);
|
|
35758
35784
|
}
|
|
35759
|
-
|
|
35760
|
-
|
|
35761
|
-
|
|
35762
|
-
|
|
35785
|
+
for (const [ecosystemKey, packages] of byEcosystem) {
|
|
35786
|
+
const descriptor = ecosystemCatalog.get(ecosystemKey);
|
|
35787
|
+
if (!descriptor)
|
|
35788
|
+
continue;
|
|
35789
|
+
const hasWorkspace = ecosystemKey === "js" ? workspaces.some((w2) => JS_WS_TYPES.has(w2.type)) : ecosystemKey === "rust" ? workspaces.some((w2) => w2.type === "cargo") : false;
|
|
35790
|
+
const ecoConfig = ctx2.config.ecosystems?.[ecosystemKey];
|
|
35791
|
+
let testGroupValidated = false;
|
|
35792
|
+
let buildGroupValidated = false;
|
|
35793
|
+
for (const pkg of packages) {
|
|
35794
|
+
if (!ctx2.options.skipTests) {
|
|
35795
|
+
const hasCommand = pkg.testCommand ?? ecoConfig?.testCommand;
|
|
35796
|
+
if (!hasCommand) {
|
|
35797
|
+
const script = pkg.testScript ?? ecoConfig?.testScript ?? ctx2.options.testScript;
|
|
35798
|
+
const isPackageOverride = !!pkg.testScript;
|
|
35799
|
+
const validateCwd = hasWorkspace && !isPackageOverride ? ctx2.cwd : import_node_path21.default.resolve(ctx2.cwd, pkg.path);
|
|
35800
|
+
if (!hasWorkspace || isPackageOverride || !testGroupValidated) {
|
|
35801
|
+
const instance = new descriptor.ecosystemClass(validateCwd);
|
|
35802
|
+
const error4 = await instance.validateScript(script, "test");
|
|
35803
|
+
if (error4)
|
|
35804
|
+
errors.push(error4);
|
|
35805
|
+
if (hasWorkspace && !isPackageOverride)
|
|
35806
|
+
testGroupValidated = true;
|
|
35807
|
+
}
|
|
35808
|
+
}
|
|
35809
|
+
}
|
|
35810
|
+
if (!ctx2.options.skipBuild) {
|
|
35811
|
+
const hasCommand = pkg.buildCommand ?? ecoConfig?.buildCommand;
|
|
35812
|
+
if (!hasCommand) {
|
|
35813
|
+
const script = pkg.buildScript ?? ecoConfig?.buildScript ?? ctx2.options.buildScript;
|
|
35814
|
+
const isPackageOverride = !!pkg.buildScript;
|
|
35815
|
+
const validateCwd = hasWorkspace && !isPackageOverride ? ctx2.cwd : import_node_path21.default.resolve(ctx2.cwd, pkg.path);
|
|
35816
|
+
if (!hasWorkspace || isPackageOverride || !buildGroupValidated) {
|
|
35817
|
+
const instance = new descriptor.ecosystemClass(validateCwd);
|
|
35818
|
+
const error4 = await instance.validateScript(script, "build");
|
|
35819
|
+
if (error4)
|
|
35820
|
+
errors.push(error4);
|
|
35821
|
+
if (hasWorkspace && !isPackageOverride)
|
|
35822
|
+
buildGroupValidated = true;
|
|
35823
|
+
}
|
|
35824
|
+
}
|
|
35825
|
+
}
|
|
35826
|
+
}
|
|
35763
35827
|
}
|
|
35764
35828
|
if (errors.length) {
|
|
35765
35829
|
throw new RequiredConditionCheckError(t("error.conditions.scriptsMissing", {
|
|
@@ -36609,24 +36673,158 @@ ${repositoryUrl}/compare/${lastRev}...${tag}`;
|
|
|
36609
36673
|
init_catalog2();
|
|
36610
36674
|
init_error4();
|
|
36611
36675
|
init_i18n();
|
|
36676
|
+
var import_node_path24 = __toESM(require("node:path"));
|
|
36612
36677
|
init_exec();
|
|
36613
|
-
|
|
36614
|
-
|
|
36678
|
+
var JS_WORKSPACE_TYPES = new Set(["pnpm", "npm", "yarn", "bun", "deno"]);
|
|
36679
|
+
var ECOSYSTEM_DEFAULTS = {
|
|
36680
|
+
js: { test: "test", build: "build" },
|
|
36681
|
+
rust: { test: "test", build: "build --release" }
|
|
36682
|
+
};
|
|
36683
|
+
function hasWorkspaceForEcosystem(cwd, ecosystemKey) {
|
|
36684
|
+
const workspaces = detectWorkspace(cwd);
|
|
36685
|
+
if (ecosystemKey === "js") {
|
|
36686
|
+
return workspaces.some((w2) => JS_WORKSPACE_TYPES.has(w2.type));
|
|
36687
|
+
}
|
|
36688
|
+
if (ecosystemKey === "rust") {
|
|
36689
|
+
return workspaces.some((w2) => w2.type === "cargo");
|
|
36690
|
+
}
|
|
36691
|
+
return false;
|
|
36692
|
+
}
|
|
36693
|
+
function hasPackageLevelOverride(pkg, type) {
|
|
36694
|
+
return type === "test" ? !!(pkg.testCommand || pkg.testScript) : !!(pkg.buildCommand || pkg.buildScript);
|
|
36695
|
+
}
|
|
36696
|
+
function resolveScript(pkg, ecosystemKey, ctx, type) {
|
|
36697
|
+
const sf = type === "test" ? "testScript" : "buildScript";
|
|
36698
|
+
const cf = type === "test" ? "testCommand" : "buildCommand";
|
|
36699
|
+
if (pkg[cf])
|
|
36700
|
+
return { command: pkg[cf] };
|
|
36701
|
+
if (pkg[sf])
|
|
36702
|
+
return { script: pkg[sf] };
|
|
36703
|
+
const eco = ctx.config.ecosystems?.[ecosystemKey];
|
|
36704
|
+
if (eco?.[cf])
|
|
36705
|
+
return { command: eco[cf] };
|
|
36706
|
+
if (eco?.[sf])
|
|
36707
|
+
return { script: eco[sf] };
|
|
36708
|
+
const globalScript = type === "test" ? ctx.options.testScript : ctx.options.buildScript;
|
|
36709
|
+
if (globalScript)
|
|
36710
|
+
return { script: globalScript };
|
|
36711
|
+
return { script: ECOSYSTEM_DEFAULTS[ecosystemKey]?.[type] ?? type };
|
|
36712
|
+
}
|
|
36713
|
+
function groupByEcosystem(ctx, type) {
|
|
36714
|
+
const map = new Map;
|
|
36615
36715
|
for (const pkg of ctx.config.packages) {
|
|
36616
|
-
|
|
36716
|
+
const key = pkg.ecosystem ?? "js";
|
|
36717
|
+
if (!map.has(key))
|
|
36718
|
+
map.set(key, { group: [], individual: [] });
|
|
36719
|
+
const entry = map.get(key);
|
|
36720
|
+
if (hasPackageLevelOverride(pkg, type)) {
|
|
36721
|
+
entry.individual.push(pkg);
|
|
36722
|
+
} else {
|
|
36723
|
+
entry.group.push(pkg);
|
|
36724
|
+
}
|
|
36725
|
+
}
|
|
36726
|
+
const result = [];
|
|
36727
|
+
for (const descriptor of ecosystemCatalog.all()) {
|
|
36728
|
+
const entry = map.get(descriptor.key);
|
|
36729
|
+
if (!entry)
|
|
36730
|
+
continue;
|
|
36731
|
+
if (entry.group.length === 0 && entry.individual.length === 0)
|
|
36732
|
+
continue;
|
|
36733
|
+
result.push({
|
|
36734
|
+
ecosystemKey: descriptor.key,
|
|
36735
|
+
groupPackages: entry.group,
|
|
36736
|
+
individualPackages: entry.individual,
|
|
36737
|
+
hasWorkspace: hasWorkspaceForEcosystem(ctx.cwd, descriptor.key)
|
|
36738
|
+
});
|
|
36617
36739
|
}
|
|
36618
|
-
return
|
|
36740
|
+
return result;
|
|
36619
36741
|
}
|
|
36620
|
-
async function
|
|
36621
|
-
const
|
|
36622
|
-
const
|
|
36623
|
-
|
|
36624
|
-
|
|
36742
|
+
async function resolveExecutions(ctx, type) {
|
|
36743
|
+
const groups = groupByEcosystem(ctx, type);
|
|
36744
|
+
const executions = [];
|
|
36745
|
+
for (const group of groups) {
|
|
36746
|
+
const descriptor = ecosystemCatalog.get(group.ecosystemKey);
|
|
36747
|
+
if (!descriptor)
|
|
36748
|
+
continue;
|
|
36749
|
+
if (group.groupPackages.length > 0) {
|
|
36750
|
+
const resolved = resolveScript(group.groupPackages[0], group.ecosystemKey, ctx, type);
|
|
36751
|
+
if (resolved.command) {
|
|
36752
|
+
if (group.hasWorkspace) {
|
|
36753
|
+
executions.push({
|
|
36754
|
+
label: resolved.command,
|
|
36755
|
+
cmd: "sh",
|
|
36756
|
+
args: ["-c", resolved.command],
|
|
36757
|
+
cwd: ctx.cwd
|
|
36758
|
+
});
|
|
36759
|
+
} else {
|
|
36760
|
+
for (const pkg of group.groupPackages) {
|
|
36761
|
+
const pkgCwd = import_node_path24.default.resolve(ctx.cwd, pkg.path);
|
|
36762
|
+
executions.push({
|
|
36763
|
+
label: `${resolved.command} (${pkg.path})`,
|
|
36764
|
+
cmd: "sh",
|
|
36765
|
+
args: ["-c", resolved.command],
|
|
36766
|
+
cwd: pkgCwd
|
|
36767
|
+
});
|
|
36768
|
+
}
|
|
36769
|
+
}
|
|
36770
|
+
} else if (resolved.script) {
|
|
36771
|
+
if (group.hasWorkspace) {
|
|
36772
|
+
const instance = new descriptor.ecosystemClass(ctx.cwd);
|
|
36773
|
+
const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
|
|
36774
|
+
executions.push({
|
|
36775
|
+
label: `${cmd} ${args.join(" ")}`,
|
|
36776
|
+
cmd,
|
|
36777
|
+
args,
|
|
36778
|
+
cwd: ctx.cwd
|
|
36779
|
+
});
|
|
36780
|
+
} else {
|
|
36781
|
+
for (const pkg of group.groupPackages) {
|
|
36782
|
+
const pkgCwd = import_node_path24.default.resolve(ctx.cwd, pkg.path);
|
|
36783
|
+
const instance = new descriptor.ecosystemClass(pkgCwd);
|
|
36784
|
+
const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
|
|
36785
|
+
executions.push({
|
|
36786
|
+
label: `${cmd} ${args.join(" ")} (${pkg.path})`,
|
|
36787
|
+
cmd,
|
|
36788
|
+
args,
|
|
36789
|
+
cwd: pkgCwd
|
|
36790
|
+
});
|
|
36791
|
+
}
|
|
36792
|
+
}
|
|
36793
|
+
}
|
|
36794
|
+
}
|
|
36795
|
+
for (const pkg of group.individualPackages) {
|
|
36796
|
+
const pkgCwd = import_node_path24.default.resolve(ctx.cwd, pkg.path);
|
|
36797
|
+
const resolved = resolveScript(pkg, group.ecosystemKey, ctx, type);
|
|
36798
|
+
if (resolved.command) {
|
|
36799
|
+
executions.push({
|
|
36800
|
+
label: `${resolved.command} (${pkg.path})`,
|
|
36801
|
+
cmd: "sh",
|
|
36802
|
+
args: ["-c", resolved.command],
|
|
36803
|
+
cwd: pkgCwd
|
|
36804
|
+
});
|
|
36805
|
+
} else if (resolved.script) {
|
|
36806
|
+
const instance = new descriptor.ecosystemClass(pkgCwd);
|
|
36807
|
+
const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
|
|
36808
|
+
executions.push({
|
|
36809
|
+
label: `${cmd} ${args.join(" ")} (${pkg.path})`,
|
|
36810
|
+
cmd,
|
|
36811
|
+
args,
|
|
36812
|
+
cwd: pkgCwd
|
|
36813
|
+
});
|
|
36814
|
+
}
|
|
36815
|
+
}
|
|
36816
|
+
}
|
|
36817
|
+
return executions;
|
|
36818
|
+
}
|
|
36819
|
+
async function runExecution(execution, ctx, task) {
|
|
36820
|
+
const liveOutput = shouldRenderLiveCommandOutput(ctx) ? createLiveCommandOutput(task, execution.label) : undefined;
|
|
36821
|
+
task.output = `Executing \`${execution.label}\``;
|
|
36625
36822
|
try {
|
|
36626
|
-
await exec3(cmd, args, {
|
|
36823
|
+
await exec3(execution.cmd, execution.args, {
|
|
36627
36824
|
onStdout: liveOutput?.onStdout,
|
|
36628
36825
|
onStderr: liveOutput?.onStderr,
|
|
36629
|
-
throwOnError: true
|
|
36826
|
+
throwOnError: true,
|
|
36827
|
+
nodeOptions: { cwd: execution.cwd }
|
|
36630
36828
|
});
|
|
36631
36829
|
} finally {
|
|
36632
36830
|
liveOutput?.finish();
|
|
@@ -36639,29 +36837,24 @@ function createTestTask(hasPrepare, skipTests) {
|
|
|
36639
36837
|
task: async (ctx, task) => {
|
|
36640
36838
|
task.output = t("task.test.runningBeforeHooks");
|
|
36641
36839
|
await ctx.runtime.pluginRunner.runHook("beforeTest", ctx);
|
|
36642
|
-
const
|
|
36643
|
-
const
|
|
36644
|
-
|
|
36645
|
-
|
|
36646
|
-
|
|
36647
|
-
continue;
|
|
36648
|
-
const instance = new descriptor.ecosystemClass(ctx.cwd);
|
|
36649
|
-
const command = await instance.defaultTestCommand(ctx.options.testScript);
|
|
36650
|
-
executedCommands.push(command);
|
|
36651
|
-
task.title = t("task.test.titleWithCommand", { command });
|
|
36840
|
+
const executions = await resolveExecutions(ctx, "test");
|
|
36841
|
+
for (const execution of executions) {
|
|
36842
|
+
task.title = t("task.test.titleWithCommand", {
|
|
36843
|
+
command: execution.label
|
|
36844
|
+
});
|
|
36652
36845
|
try {
|
|
36653
|
-
await
|
|
36846
|
+
await runExecution(execution, ctx, task);
|
|
36654
36847
|
} catch (error4) {
|
|
36655
36848
|
throw new AbstractError(t("error.test.failedWithHint", {
|
|
36656
|
-
script:
|
|
36657
|
-
command
|
|
36849
|
+
script: execution.label,
|
|
36850
|
+
command: execution.label
|
|
36658
36851
|
}), { cause: error4 });
|
|
36659
36852
|
}
|
|
36660
36853
|
}
|
|
36661
36854
|
task.output = t("task.test.runningAfterHooks");
|
|
36662
36855
|
await ctx.runtime.pluginRunner.runHook("afterTest", ctx);
|
|
36663
36856
|
task.output = t("task.test.completed", {
|
|
36664
|
-
command:
|
|
36857
|
+
command: executions.map((e3) => e3.label).join(", ")
|
|
36665
36858
|
});
|
|
36666
36859
|
}
|
|
36667
36860
|
};
|
|
@@ -36673,29 +36866,24 @@ function createBuildTask(hasPrepare, skipBuild) {
|
|
|
36673
36866
|
task: async (ctx, task) => {
|
|
36674
36867
|
task.output = t("task.build.runningBeforeHooks");
|
|
36675
36868
|
await ctx.runtime.pluginRunner.runHook("beforeBuild", ctx);
|
|
36676
|
-
const
|
|
36677
|
-
const
|
|
36678
|
-
|
|
36679
|
-
|
|
36680
|
-
|
|
36681
|
-
continue;
|
|
36682
|
-
const instance = new descriptor.ecosystemClass(ctx.cwd);
|
|
36683
|
-
const command = await instance.defaultBuildCommand(ctx.options.buildScript);
|
|
36684
|
-
executedCommands.push(command);
|
|
36685
|
-
task.title = t("task.build.titleWithCommand", { command });
|
|
36869
|
+
const executions = await resolveExecutions(ctx, "build");
|
|
36870
|
+
for (const execution of executions) {
|
|
36871
|
+
task.title = t("task.build.titleWithCommand", {
|
|
36872
|
+
command: execution.label
|
|
36873
|
+
});
|
|
36686
36874
|
try {
|
|
36687
|
-
await
|
|
36875
|
+
await runExecution(execution, ctx, task);
|
|
36688
36876
|
} catch (error4) {
|
|
36689
36877
|
throw new AbstractError(t("error.build.failedWithHint", {
|
|
36690
|
-
script:
|
|
36691
|
-
command
|
|
36878
|
+
script: execution.label,
|
|
36879
|
+
command: execution.label
|
|
36692
36880
|
}), { cause: error4 });
|
|
36693
36881
|
}
|
|
36694
36882
|
}
|
|
36695
36883
|
task.output = t("task.build.runningAfterHooks");
|
|
36696
36884
|
await ctx.runtime.pluginRunner.runHook("afterBuild", ctx);
|
|
36697
36885
|
task.output = t("task.build.completed", {
|
|
36698
|
-
command:
|
|
36886
|
+
command: executions.map((e3) => e3.label).join(", ")
|
|
36699
36887
|
});
|
|
36700
36888
|
}
|
|
36701
36889
|
};
|
|
@@ -36703,13 +36891,13 @@ function createBuildTask(hasPrepare, skipBuild) {
|
|
|
36703
36891
|
|
|
36704
36892
|
// src/tasks/phases/version.ts
|
|
36705
36893
|
init_dist2();
|
|
36706
|
-
var
|
|
36894
|
+
var import_node_path27 = __toESM(require("node:path"));
|
|
36707
36895
|
|
|
36708
36896
|
// src/changelog/file.ts
|
|
36709
36897
|
var import_node_fs15 = require("node:fs");
|
|
36710
|
-
var
|
|
36898
|
+
var import_node_path25 = __toESM(require("node:path"));
|
|
36711
36899
|
function writeChangelogToFile(cwd, newContent) {
|
|
36712
|
-
const changelogPath =
|
|
36900
|
+
const changelogPath = import_node_path25.default.join(cwd, "CHANGELOG.md");
|
|
36713
36901
|
let existing = "";
|
|
36714
36902
|
if (import_node_fs15.existsSync(changelogPath)) {
|
|
36715
36903
|
existing = import_node_fs15.readFileSync(changelogPath, "utf-8");
|
|
@@ -36774,7 +36962,7 @@ function buildChangelogEntries(changesets, packagePath) {
|
|
|
36774
36962
|
|
|
36775
36963
|
// src/changeset/reader.ts
|
|
36776
36964
|
var import_node_fs16 = require("node:fs");
|
|
36777
|
-
var
|
|
36965
|
+
var import_node_path26 = __toESM(require("node:path"));
|
|
36778
36966
|
var import_node_process18 = __toESM(require("node:process"));
|
|
36779
36967
|
|
|
36780
36968
|
// src/changeset/parser.ts
|
|
@@ -36795,8 +36983,8 @@ function parseChangeset(content, fileName, resolveKey) {
|
|
|
36795
36983
|
if (!VALID_BUMP_TYPES.has(type)) {
|
|
36796
36984
|
throw new Error(`Invalid bump type "${type}" for package "${key}" in "${fileName}". Expected: patch, minor, or major.`);
|
|
36797
36985
|
}
|
|
36798
|
-
const
|
|
36799
|
-
releases.push({ path:
|
|
36986
|
+
const path16 = resolveKey ? resolveKey(key) : key;
|
|
36987
|
+
releases.push({ path: path16, type });
|
|
36800
36988
|
}
|
|
36801
36989
|
}
|
|
36802
36990
|
const id = fileName.replace(/\.md$/, "");
|
|
@@ -36809,7 +36997,7 @@ function parseChangeset(content, fileName, resolveKey) {
|
|
|
36809
36997
|
|
|
36810
36998
|
// src/changeset/reader.ts
|
|
36811
36999
|
function readChangesets(cwd = import_node_process18.default.cwd(), resolveKey) {
|
|
36812
|
-
const changesetsDir =
|
|
37000
|
+
const changesetsDir = import_node_path26.default.join(cwd, ".pubm", "changesets");
|
|
36813
37001
|
if (!import_node_fs16.existsSync(changesetsDir)) {
|
|
36814
37002
|
return [];
|
|
36815
37003
|
}
|
|
@@ -36819,16 +37007,16 @@ function readChangesets(cwd = import_node_process18.default.cwd(), resolveKey) {
|
|
|
36819
37007
|
if (!file.endsWith(".md") || file === "README.md") {
|
|
36820
37008
|
continue;
|
|
36821
37009
|
}
|
|
36822
|
-
const filePath =
|
|
37010
|
+
const filePath = import_node_path26.default.join(changesetsDir, file);
|
|
36823
37011
|
const content = import_node_fs16.readFileSync(filePath, "utf-8");
|
|
36824
37012
|
changesets.push(parseChangeset(content, file, resolveKey));
|
|
36825
37013
|
}
|
|
36826
37014
|
return changesets;
|
|
36827
37015
|
}
|
|
36828
37016
|
function deleteChangesetFiles(cwd, changesets) {
|
|
36829
|
-
const changesetsDir =
|
|
37017
|
+
const changesetsDir = import_node_path26.default.join(cwd, ".pubm", "changesets");
|
|
36830
37018
|
for (const changeset of changesets) {
|
|
36831
|
-
const filePath =
|
|
37019
|
+
const filePath = import_node_path26.default.join(changesetsDir, `${changeset.id}.md`);
|
|
36832
37020
|
if (import_node_fs16.existsSync(filePath)) {
|
|
36833
37021
|
import_node_fs16.rmSync(filePath);
|
|
36834
37022
|
}
|
|
@@ -36885,7 +37073,7 @@ function createVersionTask(hasPrepare, dryRun) {
|
|
|
36885
37073
|
const changesets = readChangesets(ctx.cwd, resolver);
|
|
36886
37074
|
if (changesets.length > 0) {
|
|
36887
37075
|
registerChangesetBackups(ctx, changesets);
|
|
36888
|
-
const changelogPath =
|
|
37076
|
+
const changelogPath = import_node_path27.default.join(ctx.cwd, "CHANGELOG.md");
|
|
36889
37077
|
registerChangelogBackup(ctx, changelogPath);
|
|
36890
37078
|
const pkgPath = ctx.config.packages[0]?.path ?? "";
|
|
36891
37079
|
const entries = buildChangelogEntries(changesets, pkgPath);
|
|
@@ -36942,7 +37130,7 @@ ${ctx.config.packages.map((pkg) => `- ${pkg.name}: ${plan.version}`).join(`
|
|
|
36942
37130
|
const changesets = readChangesets(ctx.cwd, resolver);
|
|
36943
37131
|
if (changesets.length > 0) {
|
|
36944
37132
|
registerChangesetBackups(ctx, changesets);
|
|
36945
|
-
const changelogPath =
|
|
37133
|
+
const changelogPath = import_node_path27.default.join(ctx.cwd, "CHANGELOG.md");
|
|
36946
37134
|
registerChangelogBackup(ctx, changelogPath);
|
|
36947
37135
|
const allEntries = [...plan.packages.keys()].flatMap((pkgPath) => buildChangelogEntries(changesets, pkgPath));
|
|
36948
37136
|
if (allEntries.length > 0) {
|
|
@@ -37002,15 +37190,15 @@ ${[...plan.packages].map(([pkgPath]) => `- ${getPackageName(ctx, pkgPath)}: ${pl
|
|
|
37002
37190
|
registerChangesetBackups(ctx, changesets);
|
|
37003
37191
|
for (const [pkgPath] of plan.packages) {
|
|
37004
37192
|
const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
|
|
37005
|
-
const changelogDir = pkgConfig ?
|
|
37006
|
-
const changelogPath =
|
|
37193
|
+
const changelogDir = pkgConfig ? import_node_path27.default.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
|
|
37194
|
+
const changelogPath = import_node_path27.default.join(changelogDir, "CHANGELOG.md");
|
|
37007
37195
|
registerChangelogBackup(ctx, changelogPath);
|
|
37008
37196
|
}
|
|
37009
37197
|
for (const [pkgPath, pkgVersion] of plan.packages) {
|
|
37010
37198
|
const entries = buildChangelogEntries(changesets, pkgPath);
|
|
37011
37199
|
if (entries.length > 0) {
|
|
37012
37200
|
const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
|
|
37013
|
-
const changelogDir = pkgConfig ?
|
|
37201
|
+
const changelogDir = pkgConfig ? import_node_path27.default.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
|
|
37014
37202
|
writeChangelogToFile(changelogDir, generateChangelog(pkgVersion, entries));
|
|
37015
37203
|
}
|
|
37016
37204
|
}
|
|
@@ -37262,11 +37450,11 @@ function maxBump(a3, b2) {
|
|
|
37262
37450
|
}
|
|
37263
37451
|
// src/changeset/migrate.ts
|
|
37264
37452
|
var import_node_fs17 = require("node:fs");
|
|
37265
|
-
var
|
|
37453
|
+
var import_node_path28 = __toESM(require("node:path"));
|
|
37266
37454
|
var import_node_process20 = __toESM(require("node:process"));
|
|
37267
37455
|
var SKIPPED_FILES = new Set(["config.json", "README.md"]);
|
|
37268
37456
|
function migrateFromChangesets(cwd = import_node_process20.default.cwd()) {
|
|
37269
|
-
const changesetDir =
|
|
37457
|
+
const changesetDir = import_node_path28.default.join(cwd, ".changeset");
|
|
37270
37458
|
if (!import_node_fs17.existsSync(changesetDir)) {
|
|
37271
37459
|
return {
|
|
37272
37460
|
success: false,
|
|
@@ -37275,7 +37463,7 @@ function migrateFromChangesets(cwd = import_node_process20.default.cwd()) {
|
|
|
37275
37463
|
configMigrated: false
|
|
37276
37464
|
};
|
|
37277
37465
|
}
|
|
37278
|
-
const pubmDir =
|
|
37466
|
+
const pubmDir = import_node_path28.default.join(cwd, ".pubm", "changesets");
|
|
37279
37467
|
import_node_fs17.mkdirSync(pubmDir, { recursive: true });
|
|
37280
37468
|
const files = import_node_fs17.readdirSync(changesetDir);
|
|
37281
37469
|
const migratedFiles = [];
|
|
@@ -37289,13 +37477,13 @@ function migrateFromChangesets(cwd = import_node_process20.default.cwd()) {
|
|
|
37289
37477
|
continue;
|
|
37290
37478
|
}
|
|
37291
37479
|
if (file === "pre.json") {
|
|
37292
|
-
import_node_fs17.copyFileSync(
|
|
37480
|
+
import_node_fs17.copyFileSync(import_node_path28.default.join(changesetDir, file), import_node_path28.default.resolve(cwd, ".pubm", "pre.json"));
|
|
37293
37481
|
migratedFiles.push(file);
|
|
37294
37482
|
continue;
|
|
37295
37483
|
}
|
|
37296
37484
|
if (file.endsWith(".md")) {
|
|
37297
|
-
const src =
|
|
37298
|
-
const dest =
|
|
37485
|
+
const src = import_node_path28.default.join(changesetDir, file);
|
|
37486
|
+
const dest = import_node_path28.default.join(pubmDir, file);
|
|
37299
37487
|
import_node_fs17.copyFileSync(src, dest);
|
|
37300
37488
|
migratedFiles.push(file);
|
|
37301
37489
|
}
|
|
@@ -37369,7 +37557,7 @@ function calculateVersionBumps(currentVersions, cwd = import_node_process22.defa
|
|
|
37369
37557
|
}
|
|
37370
37558
|
// src/changeset/writer.ts
|
|
37371
37559
|
var import_node_fs18 = require("node:fs");
|
|
37372
|
-
var
|
|
37560
|
+
var import_node_path29 = __toESM(require("node:path"));
|
|
37373
37561
|
var import_node_process23 = __toESM(require("node:process"));
|
|
37374
37562
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
37375
37563
|
var adjectives = [
|
|
@@ -37466,11 +37654,11 @@ ${summary}
|
|
|
37466
37654
|
return content;
|
|
37467
37655
|
}
|
|
37468
37656
|
function writeChangeset(releases, summary, cwd = import_node_process23.default.cwd()) {
|
|
37469
|
-
const changesetsDir =
|
|
37657
|
+
const changesetsDir = import_node_path29.default.join(cwd, ".pubm", "changesets");
|
|
37470
37658
|
import_node_fs18.mkdirSync(changesetsDir, { recursive: true });
|
|
37471
37659
|
const id = generateChangesetId();
|
|
37472
37660
|
const fileName = `${id}.md`;
|
|
37473
|
-
const filePath =
|
|
37661
|
+
const filePath = import_node_path29.default.join(changesetsDir, fileName);
|
|
37474
37662
|
const content = generateChangesetContent(releases, summary);
|
|
37475
37663
|
import_node_fs18.writeFileSync(filePath, content, "utf-8");
|
|
37476
37664
|
return filePath;
|
|
@@ -37478,6 +37666,8 @@ function writeChangeset(releases, summary, cwd = import_node_process23.default.c
|
|
|
37478
37666
|
// src/config/defaults.ts
|
|
37479
37667
|
init_catalog2();
|
|
37480
37668
|
init_i18n();
|
|
37669
|
+
var import_node_path30 = __toESM(require("node:path"));
|
|
37670
|
+
var import_micromatch4 = __toESM(require_micromatch(), 1);
|
|
37481
37671
|
init_catalog();
|
|
37482
37672
|
var defaultValidate = {
|
|
37483
37673
|
cleanInstall: true,
|
|
@@ -37523,6 +37713,16 @@ async function resolveConfig(config, cwd) {
|
|
|
37523
37713
|
}
|
|
37524
37714
|
}
|
|
37525
37715
|
}
|
|
37716
|
+
if (config.ecosystems) {
|
|
37717
|
+
for (const key of Object.keys(config.ecosystems)) {
|
|
37718
|
+
if (!ecosystemCatalog.get(key)) {
|
|
37719
|
+
throw new Error(t("error.config.unknownEcosystem", {
|
|
37720
|
+
ecosystem: key,
|
|
37721
|
+
list: ecosystemCatalog.all().map((d3) => d3.key).join(", ")
|
|
37722
|
+
}));
|
|
37723
|
+
}
|
|
37724
|
+
}
|
|
37725
|
+
}
|
|
37526
37726
|
const configPackages = config.packages?.map((pkg) => {
|
|
37527
37727
|
if (!pkg.registries)
|
|
37528
37728
|
return pkg;
|
|
@@ -37544,15 +37744,29 @@ async function resolveConfig(config, cwd) {
|
|
|
37544
37744
|
discoveryEmpty = true;
|
|
37545
37745
|
packages = [];
|
|
37546
37746
|
} else {
|
|
37547
|
-
packages = discovered.map((pkg) =>
|
|
37548
|
-
|
|
37549
|
-
|
|
37550
|
-
|
|
37551
|
-
|
|
37552
|
-
|
|
37553
|
-
|
|
37554
|
-
|
|
37555
|
-
|
|
37747
|
+
packages = discovered.map((pkg) => {
|
|
37748
|
+
const configPkg = configPackages?.find((cp) => {
|
|
37749
|
+
const normalized = cp.path.replace(/\\/g, "/");
|
|
37750
|
+
const pkgPathForward = pkg.path.replace(/\\/g, "/");
|
|
37751
|
+
if (import_micromatch4.default.scan(normalized).isGlob) {
|
|
37752
|
+
return import_micromatch4.default.isMatch(pkgPathForward, normalized);
|
|
37753
|
+
}
|
|
37754
|
+
return import_node_path30.default.normalize(cp.path) === pkg.path;
|
|
37755
|
+
});
|
|
37756
|
+
return {
|
|
37757
|
+
path: pkg.path,
|
|
37758
|
+
name: pkg.name,
|
|
37759
|
+
version: pkg.version,
|
|
37760
|
+
dependencies: pkg.dependencies,
|
|
37761
|
+
ecosystem: pkg.ecosystem,
|
|
37762
|
+
registries: pkg.registries,
|
|
37763
|
+
...pkg.registryVersions ? { registryVersions: pkg.registryVersions } : {},
|
|
37764
|
+
...configPkg?.testScript ? { testScript: configPkg.testScript } : {},
|
|
37765
|
+
...configPkg?.testCommand ? { testCommand: configPkg.testCommand } : {},
|
|
37766
|
+
...configPkg?.buildScript ? { buildScript: configPkg.buildScript } : {},
|
|
37767
|
+
...configPkg?.buildCommand ? { buildCommand: configPkg.buildCommand } : {}
|
|
37768
|
+
};
|
|
37769
|
+
});
|
|
37556
37770
|
}
|
|
37557
37771
|
return {
|
|
37558
37772
|
...defaultConfig,
|
|
@@ -37565,6 +37779,7 @@ async function resolveConfig(config, cwd) {
|
|
|
37565
37779
|
...config.rollback
|
|
37566
37780
|
},
|
|
37567
37781
|
snapshotTemplate: config.snapshotTemplate ?? defaultConfig.snapshotTemplate,
|
|
37782
|
+
ecosystems: config.ecosystems ?? {},
|
|
37568
37783
|
plugins: config.plugins ?? [],
|
|
37569
37784
|
versionSources: config.versionSources ?? defaultConfig.versionSources,
|
|
37570
37785
|
conventionalCommits: {
|
|
@@ -37586,10 +37801,10 @@ function resolveEcosystemKey(pkg, _entry) {
|
|
|
37586
37801
|
}
|
|
37587
37802
|
// src/config/loader.ts
|
|
37588
37803
|
var import_node_child_process = require("node:child_process");
|
|
37589
|
-
var
|
|
37804
|
+
var import_promises8 = require("node:fs/promises");
|
|
37590
37805
|
var import_node_module2 = require("node:module");
|
|
37591
37806
|
var import_node_os5 = require("node:os");
|
|
37592
|
-
var
|
|
37807
|
+
var import_node_path31 = __toESM(require("node:path"));
|
|
37593
37808
|
var import_node_url = require("node:url");
|
|
37594
37809
|
var import_node_vm = __toESM(require("node:vm"));
|
|
37595
37810
|
var CONFIG_FILES = [
|
|
@@ -37642,9 +37857,9 @@ var CONFIG_MODULE_SHIMS = {
|
|
|
37642
37857
|
};
|
|
37643
37858
|
async function findConfigFile(cwd) {
|
|
37644
37859
|
for (const file of CONFIG_FILES) {
|
|
37645
|
-
const filePath =
|
|
37860
|
+
const filePath = import_node_path31.default.join(cwd, file);
|
|
37646
37861
|
try {
|
|
37647
|
-
if ((await
|
|
37862
|
+
if ((await import_promises8.stat(filePath)).isFile()) {
|
|
37648
37863
|
return filePath;
|
|
37649
37864
|
}
|
|
37650
37865
|
} catch {}
|
|
@@ -37663,15 +37878,15 @@ function isBareSpecifier(specifier) {
|
|
|
37663
37878
|
return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("file:") && !specifier.startsWith("node:");
|
|
37664
37879
|
}
|
|
37665
37880
|
async function findClosestPackageManifest(filePath) {
|
|
37666
|
-
let current =
|
|
37881
|
+
let current = import_node_path31.default.dirname(filePath);
|
|
37667
37882
|
while (true) {
|
|
37668
|
-
const manifestPath =
|
|
37883
|
+
const manifestPath = import_node_path31.default.join(current, "package.json");
|
|
37669
37884
|
try {
|
|
37670
|
-
if ((await
|
|
37885
|
+
if ((await import_promises8.stat(manifestPath)).isFile()) {
|
|
37671
37886
|
return manifestPath;
|
|
37672
37887
|
}
|
|
37673
37888
|
} catch {}
|
|
37674
|
-
const parent =
|
|
37889
|
+
const parent = import_node_path31.default.dirname(current);
|
|
37675
37890
|
if (parent === current) {
|
|
37676
37891
|
return null;
|
|
37677
37892
|
}
|
|
@@ -37687,7 +37902,7 @@ async function isOptionalDependencyImport(specifier, importerPath) {
|
|
|
37687
37902
|
return false;
|
|
37688
37903
|
}
|
|
37689
37904
|
const packageName = getPackageName2(specifier);
|
|
37690
|
-
const manifest = JSON.parse(await
|
|
37905
|
+
const manifest = JSON.parse(await import_promises8.readFile(manifestPath, "utf8"));
|
|
37691
37906
|
if (manifest.optionalDependencies?.[packageName]) {
|
|
37692
37907
|
return true;
|
|
37693
37908
|
}
|
|
@@ -37758,7 +37973,7 @@ async function collectOptionalDependenciesForInputs(inputPaths) {
|
|
|
37758
37973
|
}
|
|
37759
37974
|
const optionalDependencies = new Set;
|
|
37760
37975
|
for (const manifestPath of manifestPaths) {
|
|
37761
|
-
const manifest = JSON.parse(await
|
|
37976
|
+
const manifest = JSON.parse(await import_promises8.readFile(manifestPath, "utf8"));
|
|
37762
37977
|
for (const dependency of Object.keys(manifest.optionalDependencies ?? {})) {
|
|
37763
37978
|
optionalDependencies.add(dependency);
|
|
37764
37979
|
}
|
|
@@ -37773,13 +37988,13 @@ async function collectOptionalDependenciesForInputs(inputPaths) {
|
|
|
37773
37988
|
async function findInstalledPackagePath(startDir, dependency) {
|
|
37774
37989
|
let current = startDir;
|
|
37775
37990
|
while (true) {
|
|
37776
|
-
const packageDir =
|
|
37991
|
+
const packageDir = import_node_path31.default.join(current, "node_modules", dependency);
|
|
37777
37992
|
try {
|
|
37778
|
-
if ((await
|
|
37993
|
+
if ((await import_promises8.stat(packageDir)).isDirectory()) {
|
|
37779
37994
|
return packageDir;
|
|
37780
37995
|
}
|
|
37781
37996
|
} catch {}
|
|
37782
|
-
const parent =
|
|
37997
|
+
const parent = import_node_path31.default.dirname(current);
|
|
37783
37998
|
if (parent === current) {
|
|
37784
37999
|
return null;
|
|
37785
38000
|
}
|
|
@@ -37787,19 +38002,19 @@ async function findInstalledPackagePath(startDir, dependency) {
|
|
|
37787
38002
|
}
|
|
37788
38003
|
}
|
|
37789
38004
|
async function writeOptionalDependencyStubs(moduleDir, resolveFromDir, optionalDependencies) {
|
|
37790
|
-
const nodeModulesDir =
|
|
38005
|
+
const nodeModulesDir = import_node_path31.default.join(moduleDir, "node_modules");
|
|
37791
38006
|
for (const dependency of optionalDependencies) {
|
|
37792
38007
|
if (await findInstalledPackagePath(resolveFromDir, dependency)) {
|
|
37793
38008
|
continue;
|
|
37794
38009
|
}
|
|
37795
|
-
const packageDir =
|
|
37796
|
-
await
|
|
37797
|
-
await
|
|
38010
|
+
const packageDir = import_node_path31.default.join(nodeModulesDir, dependency);
|
|
38011
|
+
await import_promises8.mkdir(packageDir, { recursive: true });
|
|
38012
|
+
await import_promises8.writeFile(import_node_path31.default.join(packageDir, "package.json"), JSON.stringify({
|
|
37798
38013
|
name: dependency,
|
|
37799
38014
|
private: true,
|
|
37800
38015
|
main: "./index.js"
|
|
37801
38016
|
}, null, 2), "utf8");
|
|
37802
|
-
await
|
|
38017
|
+
await import_promises8.writeFile(import_node_path31.default.join(packageDir, "index.js"), createOptionalDependencyProxyPackage(dependency), "utf8");
|
|
37803
38018
|
}
|
|
37804
38019
|
}
|
|
37805
38020
|
function createOptionalDependencyPlugin(specifiers) {
|
|
@@ -37853,7 +38068,7 @@ function createConfigModuleShimPlugin() {
|
|
|
37853
38068
|
};
|
|
37854
38069
|
}
|
|
37855
38070
|
async function runBunBuild(build, entrypoint, format3 = "esm", optionalDynamicImports = []) {
|
|
37856
|
-
const entrypointSource = await
|
|
38071
|
+
const entrypointSource = await import_promises8.readFile(entrypoint, "utf8");
|
|
37857
38072
|
const result = await build({
|
|
37858
38073
|
entrypoints: [entrypoint],
|
|
37859
38074
|
target: "bun",
|
|
@@ -37911,12 +38126,12 @@ async function buildConfigWithFormat(entrypoint, format3) {
|
|
|
37911
38126
|
}
|
|
37912
38127
|
async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
|
|
37913
38128
|
const extension = format3 === "esm" ? "mjs" : "cjs";
|
|
37914
|
-
const tempDir = await
|
|
37915
|
-
const buildScript =
|
|
37916
|
-
const outfile =
|
|
37917
|
-
const resultFile =
|
|
38129
|
+
const tempDir = await import_promises8.mkdtemp(import_node_path31.default.join(import_node_os5.tmpdir(), "pubm-config-"));
|
|
38130
|
+
const buildScript = import_node_path31.default.join(tempDir, "build-config.mjs");
|
|
38131
|
+
const outfile = import_node_path31.default.join(tempDir, `pubm.config.${extension}`);
|
|
38132
|
+
const resultFile = import_node_path31.default.join(tempDir, "build-result.json");
|
|
37918
38133
|
try {
|
|
37919
|
-
await
|
|
38134
|
+
await import_promises8.writeFile(buildScript, [
|
|
37920
38135
|
'import { readFile, stat, writeFile } from "node:fs/promises";',
|
|
37921
38136
|
'import path from "node:path";',
|
|
37922
38137
|
'import { pathToFileURL } from "node:url";',
|
|
@@ -38165,8 +38380,8 @@ async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
|
|
|
38165
38380
|
resolve2();
|
|
38166
38381
|
});
|
|
38167
38382
|
});
|
|
38168
|
-
const result = JSON.parse(await
|
|
38169
|
-
const contents = result.hasEntrypoint ? await
|
|
38383
|
+
const result = JSON.parse(await import_promises8.readFile(resultFile, "utf8"));
|
|
38384
|
+
const contents = result.hasEntrypoint ? await import_promises8.readFile(outfile, "utf8") : null;
|
|
38170
38385
|
return {
|
|
38171
38386
|
success: result.success,
|
|
38172
38387
|
logs: result.logs,
|
|
@@ -38185,16 +38400,16 @@ async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
|
|
|
38185
38400
|
outputs: []
|
|
38186
38401
|
};
|
|
38187
38402
|
} finally {
|
|
38188
|
-
await
|
|
38403
|
+
await import_promises8.rm(tempDir, { recursive: true, force: true });
|
|
38189
38404
|
}
|
|
38190
38405
|
}
|
|
38191
38406
|
function rewriteImportMeta(source, configPath) {
|
|
38192
38407
|
const replacements = [
|
|
38193
|
-
["import.meta.dirname", JSON.stringify(
|
|
38408
|
+
["import.meta.dirname", JSON.stringify(import_node_path31.default.dirname(configPath))],
|
|
38194
38409
|
["import.meta.filename", JSON.stringify(configPath)],
|
|
38195
38410
|
["import.meta.path", JSON.stringify(configPath)],
|
|
38196
38411
|
["import.meta.url", JSON.stringify(import_node_url.pathToFileURL(configPath).href)],
|
|
38197
|
-
["import.meta.dir", JSON.stringify(
|
|
38412
|
+
["import.meta.dir", JSON.stringify(import_node_path31.default.dirname(configPath))]
|
|
38198
38413
|
];
|
|
38199
38414
|
let rewritten = source;
|
|
38200
38415
|
for (const [pattern, value] of replacements) {
|
|
@@ -38210,14 +38425,14 @@ async function importConfigModule(configPath) {
|
|
|
38210
38425
|
return normalizeConfigNamespace(namespace);
|
|
38211
38426
|
}
|
|
38212
38427
|
async function importBundledConfig(source, configPath, optionalDependencies) {
|
|
38213
|
-
const tempDir = await
|
|
38214
|
-
const tempFile =
|
|
38428
|
+
const tempDir = await import_promises8.mkdtemp(import_node_path31.default.join(import_node_path31.default.dirname(configPath), ".pubm-config-module-"));
|
|
38429
|
+
const tempFile = import_node_path31.default.join(tempDir, "pubm.config.mjs");
|
|
38215
38430
|
try {
|
|
38216
|
-
await writeOptionalDependencyStubs(tempDir,
|
|
38217
|
-
await
|
|
38431
|
+
await writeOptionalDependencyStubs(tempDir, import_node_path31.default.dirname(configPath), optionalDependencies);
|
|
38432
|
+
await import_promises8.writeFile(tempFile, source, "utf8");
|
|
38218
38433
|
return importConfigModule(tempFile);
|
|
38219
38434
|
} finally {
|
|
38220
|
-
await
|
|
38435
|
+
await import_promises8.rm(tempDir, { recursive: true, force: true });
|
|
38221
38436
|
}
|
|
38222
38437
|
}
|
|
38223
38438
|
async function executeBundledConfigInVm(source, configPath) {
|
|
@@ -38228,7 +38443,7 @@ async function executeBundledConfigInVm(source, configPath) {
|
|
|
38228
38443
|
exports: module2.exports,
|
|
38229
38444
|
require: require2,
|
|
38230
38445
|
__filename: configPath,
|
|
38231
|
-
__dirname:
|
|
38446
|
+
__dirname: import_node_path31.default.dirname(configPath),
|
|
38232
38447
|
console,
|
|
38233
38448
|
process,
|
|
38234
38449
|
Buffer,
|
|
@@ -38259,9 +38474,9 @@ function formatStageError(stage, error4) {
|
|
|
38259
38474
|
async function loadConfig(cwd = process.cwd(), configPath) {
|
|
38260
38475
|
let resolvedConfigPath;
|
|
38261
38476
|
if (configPath) {
|
|
38262
|
-
resolvedConfigPath =
|
|
38477
|
+
resolvedConfigPath = import_node_path31.default.resolve(cwd, configPath);
|
|
38263
38478
|
try {
|
|
38264
|
-
if (!(await
|
|
38479
|
+
if (!(await import_promises8.stat(resolvedConfigPath)).isFile()) {
|
|
38265
38480
|
throw new Error(`Config path is not a file: ${resolvedConfigPath}`);
|
|
38266
38481
|
}
|
|
38267
38482
|
} catch (e3) {
|
|
@@ -38339,12 +38554,12 @@ function defineConfig(config) {
|
|
|
38339
38554
|
init_context();
|
|
38340
38555
|
|
|
38341
38556
|
// src/conventional-commit/scope-resolver.ts
|
|
38342
|
-
var
|
|
38557
|
+
var import_node_path32 = __toESM(require("node:path"));
|
|
38343
38558
|
function resolveCommitPackages(commit, packagePaths) {
|
|
38344
38559
|
const matched = new Set;
|
|
38345
38560
|
if (commit.scope) {
|
|
38346
38561
|
for (const pkgPath of packagePaths) {
|
|
38347
|
-
const dirName =
|
|
38562
|
+
const dirName = import_node_path32.default.basename(pkgPath);
|
|
38348
38563
|
if (dirName === commit.scope) {
|
|
38349
38564
|
matched.add(pkgPath);
|
|
38350
38565
|
}
|
|
@@ -38599,7 +38814,7 @@ function inspectPackages(config, cwd) {
|
|
|
38599
38814
|
init_manifest_reader();
|
|
38600
38815
|
// src/migrate/adapters/changesets.ts
|
|
38601
38816
|
var import_node_fs19 = require("node:fs");
|
|
38602
|
-
var
|
|
38817
|
+
var import_node_path33 = __toESM(require("node:path"));
|
|
38603
38818
|
var SKIPPED_DIR_ENTRIES = new Set(["config.json", "README.md", ".gitkeep"]);
|
|
38604
38819
|
var CHANGELOG_PRESET_MAP = {
|
|
38605
38820
|
"@changesets/changelog-github": "github",
|
|
@@ -38617,11 +38832,11 @@ var changesetsAdapter = {
|
|
|
38617
38832
|
name: "changesets",
|
|
38618
38833
|
configFilePatterns: [".changeset/config.json"],
|
|
38619
38834
|
async detect(cwd) {
|
|
38620
|
-
const configFile =
|
|
38835
|
+
const configFile = import_node_path33.default.join(cwd, ".changeset", "config.json");
|
|
38621
38836
|
if (!import_node_fs19.existsSync(configFile)) {
|
|
38622
38837
|
return { found: false, configFiles: [], relatedFiles: [] };
|
|
38623
38838
|
}
|
|
38624
|
-
const changesetDir =
|
|
38839
|
+
const changesetDir = import_node_path33.default.dirname(configFile);
|
|
38625
38840
|
const relatedFiles = [];
|
|
38626
38841
|
try {
|
|
38627
38842
|
const entries = import_node_fs19.readdirSync(changesetDir, { encoding: "utf-8" });
|
|
@@ -38629,7 +38844,7 @@ var changesetsAdapter = {
|
|
|
38629
38844
|
if (SKIPPED_DIR_ENTRIES.has(entry))
|
|
38630
38845
|
continue;
|
|
38631
38846
|
if (entry.endsWith(".md") || entry === "pre.json") {
|
|
38632
|
-
relatedFiles.push(
|
|
38847
|
+
relatedFiles.push(import_node_path33.default.join(changesetDir, entry));
|
|
38633
38848
|
}
|
|
38634
38849
|
}
|
|
38635
38850
|
} catch {}
|
|
@@ -38640,7 +38855,7 @@ var changesetsAdapter = {
|
|
|
38640
38855
|
};
|
|
38641
38856
|
},
|
|
38642
38857
|
async parse(files, cwd) {
|
|
38643
|
-
const configFile = files.find((f2) => f2.endsWith(`${
|
|
38858
|
+
const configFile = files.find((f2) => f2.endsWith(`${import_node_path33.default.sep}config.json`) || f2.endsWith("/config.json"));
|
|
38644
38859
|
if (configFile === undefined) {
|
|
38645
38860
|
return { source: "changesets", unmappable: [] };
|
|
38646
38861
|
}
|
|
@@ -38675,7 +38890,7 @@ var changesetsAdapter = {
|
|
|
38675
38890
|
if (hasUpdateInternalDeps)
|
|
38676
38891
|
result.monorepo.updateInternalDeps = config.updateInternalDependencies;
|
|
38677
38892
|
}
|
|
38678
|
-
const preJsonPath =
|
|
38893
|
+
const preJsonPath = import_node_path33.default.join(cwd, ".changeset", "pre.json");
|
|
38679
38894
|
if (import_node_fs19.existsSync(preJsonPath)) {
|
|
38680
38895
|
try {
|
|
38681
38896
|
const preRaw = import_node_fs19.readFileSync(preJsonPath, "utf-8");
|
|
@@ -38709,12 +38924,12 @@ var changesetsAdapter = {
|
|
|
38709
38924
|
const configFile = detected.configFiles[0];
|
|
38710
38925
|
if (configFile === undefined)
|
|
38711
38926
|
return [];
|
|
38712
|
-
return [
|
|
38927
|
+
return [import_node_path33.default.dirname(configFile)];
|
|
38713
38928
|
}
|
|
38714
38929
|
};
|
|
38715
38930
|
// src/migrate/adapters/np.ts
|
|
38716
38931
|
var import_node_fs20 = require("node:fs");
|
|
38717
|
-
var
|
|
38932
|
+
var import_node_path34 = __toESM(require("node:path"));
|
|
38718
38933
|
var import_node_url2 = require("node:url");
|
|
38719
38934
|
var STANDALONE_CONFIG_FILES = [
|
|
38720
38935
|
".np-config.json",
|
|
@@ -38819,12 +39034,12 @@ var npAdapter = {
|
|
|
38819
39034
|
async detect(cwd) {
|
|
38820
39035
|
const configFiles = [];
|
|
38821
39036
|
for (const filename of STANDALONE_CONFIG_FILES) {
|
|
38822
|
-
const filePath =
|
|
39037
|
+
const filePath = import_node_path34.default.join(cwd, filename);
|
|
38823
39038
|
if (import_node_fs20.existsSync(filePath)) {
|
|
38824
39039
|
configFiles.push(filePath);
|
|
38825
39040
|
}
|
|
38826
39041
|
}
|
|
38827
|
-
const pkgJsonPath =
|
|
39042
|
+
const pkgJsonPath = import_node_path34.default.join(cwd, PACKAGE_JSON);
|
|
38828
39043
|
if (import_node_fs20.existsSync(pkgJsonPath)) {
|
|
38829
39044
|
try {
|
|
38830
39045
|
const raw = import_node_fs20.readFileSync(pkgJsonPath, "utf-8");
|
|
@@ -38841,8 +39056,8 @@ var npAdapter = {
|
|
|
38841
39056
|
};
|
|
38842
39057
|
},
|
|
38843
39058
|
async parse(files, _cwd) {
|
|
38844
|
-
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES.some((name) => f2.endsWith(
|
|
38845
|
-
const pkgJsonFile = files.find((f2) => f2.endsWith(
|
|
39059
|
+
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES.some((name) => f2.endsWith(import_node_path34.default.sep + name) || f2.endsWith(`/${name}`)));
|
|
39060
|
+
const pkgJsonFile = files.find((f2) => f2.endsWith(import_node_path34.default.sep + PACKAGE_JSON) || f2.endsWith(`/${PACKAGE_JSON}`));
|
|
38846
39061
|
const configFile = standaloneFile ?? pkgJsonFile;
|
|
38847
39062
|
if (configFile === undefined) {
|
|
38848
39063
|
return {
|
|
@@ -38861,12 +39076,12 @@ var npAdapter = {
|
|
|
38861
39076
|
};
|
|
38862
39077
|
},
|
|
38863
39078
|
getCleanupTargets(detected) {
|
|
38864
|
-
return detected.configFiles.filter((f2) => !f2.endsWith(
|
|
39079
|
+
return detected.configFiles.filter((f2) => !f2.endsWith(import_node_path34.default.sep + PACKAGE_JSON) && !f2.endsWith(`/${PACKAGE_JSON}`));
|
|
38865
39080
|
}
|
|
38866
39081
|
};
|
|
38867
39082
|
// src/migrate/adapters/release-it.ts
|
|
38868
39083
|
var import_node_fs21 = require("node:fs");
|
|
38869
|
-
var
|
|
39084
|
+
var import_node_path35 = __toESM(require("node:path"));
|
|
38870
39085
|
var import_node_url3 = require("node:url");
|
|
38871
39086
|
var import_yaml4 = __toESM(require_dist(), 1);
|
|
38872
39087
|
var STANDALONE_CONFIG_FILES2 = [
|
|
@@ -38892,7 +39107,7 @@ async function loadConfigFile(filePath) {
|
|
|
38892
39107
|
if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
|
|
38893
39108
|
return import_yaml4.default.parse(raw);
|
|
38894
39109
|
}
|
|
38895
|
-
if (filePath.endsWith(
|
|
39110
|
+
if (filePath.endsWith(import_node_path35.default.sep + PACKAGE_JSON2) || filePath.endsWith(`/${PACKAGE_JSON2}`)) {
|
|
38896
39111
|
const parsed = JSON.parse(raw);
|
|
38897
39112
|
return parsed["release-it"] ?? {};
|
|
38898
39113
|
}
|
|
@@ -39007,12 +39222,12 @@ var releaseItAdapter = {
|
|
|
39007
39222
|
async detect(cwd) {
|
|
39008
39223
|
const configFiles = [];
|
|
39009
39224
|
for (const filename of STANDALONE_CONFIG_FILES2) {
|
|
39010
|
-
const filePath =
|
|
39225
|
+
const filePath = import_node_path35.default.join(cwd, filename);
|
|
39011
39226
|
if (import_node_fs21.existsSync(filePath)) {
|
|
39012
39227
|
configFiles.push(filePath);
|
|
39013
39228
|
}
|
|
39014
39229
|
}
|
|
39015
|
-
const pkgJsonPath =
|
|
39230
|
+
const pkgJsonPath = import_node_path35.default.join(cwd, PACKAGE_JSON2);
|
|
39016
39231
|
if (import_node_fs21.existsSync(pkgJsonPath)) {
|
|
39017
39232
|
try {
|
|
39018
39233
|
const raw = import_node_fs21.readFileSync(pkgJsonPath, "utf-8");
|
|
@@ -39029,8 +39244,8 @@ var releaseItAdapter = {
|
|
|
39029
39244
|
};
|
|
39030
39245
|
},
|
|
39031
39246
|
async parse(files, _cwd) {
|
|
39032
|
-
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES2.some((name) => f2.endsWith(
|
|
39033
|
-
const pkgJsonFile = files.find((f2) => f2.endsWith(
|
|
39247
|
+
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES2.some((name) => f2.endsWith(import_node_path35.default.sep + name) || f2.endsWith(`/${name}`)));
|
|
39248
|
+
const pkgJsonFile = files.find((f2) => f2.endsWith(import_node_path35.default.sep + PACKAGE_JSON2) || f2.endsWith(`/${PACKAGE_JSON2}`));
|
|
39034
39249
|
const configFile = standaloneFile ?? pkgJsonFile;
|
|
39035
39250
|
if (configFile === undefined) {
|
|
39036
39251
|
return {
|
|
@@ -39060,12 +39275,12 @@ var releaseItAdapter = {
|
|
|
39060
39275
|
};
|
|
39061
39276
|
},
|
|
39062
39277
|
getCleanupTargets(detected) {
|
|
39063
|
-
return detected.configFiles.filter((f2) => !f2.endsWith(
|
|
39278
|
+
return detected.configFiles.filter((f2) => !f2.endsWith(import_node_path35.default.sep + PACKAGE_JSON2) && !f2.endsWith(`/${PACKAGE_JSON2}`));
|
|
39064
39279
|
}
|
|
39065
39280
|
};
|
|
39066
39281
|
// src/migrate/adapters/semantic-release.ts
|
|
39067
39282
|
var import_node_fs22 = require("node:fs");
|
|
39068
|
-
var
|
|
39283
|
+
var import_node_path36 = __toESM(require("node:path"));
|
|
39069
39284
|
var import_node_url4 = require("node:url");
|
|
39070
39285
|
var import_yaml5 = __toESM(require_dist(), 1);
|
|
39071
39286
|
var STANDALONE_CONFIG_FILES3 = [
|
|
@@ -39156,11 +39371,11 @@ async function loadConfigFile2(filePath) {
|
|
|
39156
39371
|
if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
|
|
39157
39372
|
return import_yaml5.default.parse(raw);
|
|
39158
39373
|
}
|
|
39159
|
-
if (filePath.endsWith(
|
|
39374
|
+
if (filePath.endsWith(import_node_path36.default.sep + PACKAGE_JSON3) || filePath.endsWith(`/${PACKAGE_JSON3}`)) {
|
|
39160
39375
|
const parsed = JSON.parse(raw);
|
|
39161
39376
|
return parsed.release ?? {};
|
|
39162
39377
|
}
|
|
39163
|
-
const basename4 =
|
|
39378
|
+
const basename4 = import_node_path36.default.basename(filePath);
|
|
39164
39379
|
if (basename4 === ".releaserc") {
|
|
39165
39380
|
try {
|
|
39166
39381
|
return JSON.parse(raw);
|
|
@@ -39270,12 +39485,12 @@ var semanticReleaseAdapter = {
|
|
|
39270
39485
|
async detect(cwd) {
|
|
39271
39486
|
const configFiles = [];
|
|
39272
39487
|
for (const filename of STANDALONE_CONFIG_FILES3) {
|
|
39273
|
-
const filePath =
|
|
39488
|
+
const filePath = import_node_path36.default.join(cwd, filename);
|
|
39274
39489
|
if (import_node_fs22.existsSync(filePath)) {
|
|
39275
39490
|
configFiles.push(filePath);
|
|
39276
39491
|
}
|
|
39277
39492
|
}
|
|
39278
|
-
const pkgJsonPath =
|
|
39493
|
+
const pkgJsonPath = import_node_path36.default.join(cwd, PACKAGE_JSON3);
|
|
39279
39494
|
if (import_node_fs22.existsSync(pkgJsonPath)) {
|
|
39280
39495
|
try {
|
|
39281
39496
|
const raw = import_node_fs22.readFileSync(pkgJsonPath, "utf-8");
|
|
@@ -39292,8 +39507,8 @@ var semanticReleaseAdapter = {
|
|
|
39292
39507
|
};
|
|
39293
39508
|
},
|
|
39294
39509
|
async parse(files, _cwd) {
|
|
39295
|
-
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES3.some((name) => f2.endsWith(
|
|
39296
|
-
const pkgJsonFile = files.find((f2) => f2.endsWith(
|
|
39510
|
+
const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES3.some((name) => f2.endsWith(import_node_path36.default.sep + name) || f2.endsWith(`/${name}`)));
|
|
39511
|
+
const pkgJsonFile = files.find((f2) => f2.endsWith(import_node_path36.default.sep + PACKAGE_JSON3) || f2.endsWith(`/${PACKAGE_JSON3}`));
|
|
39297
39512
|
const configFile = standaloneFile ?? pkgJsonFile;
|
|
39298
39513
|
if (configFile === undefined) {
|
|
39299
39514
|
return {
|
|
@@ -39311,12 +39526,12 @@ var semanticReleaseAdapter = {
|
|
|
39311
39526
|
};
|
|
39312
39527
|
},
|
|
39313
39528
|
getCleanupTargets(detected) {
|
|
39314
|
-
return detected.configFiles.filter((f2) => !f2.endsWith(
|
|
39529
|
+
return detected.configFiles.filter((f2) => !f2.endsWith(import_node_path36.default.sep + PACKAGE_JSON3) && !f2.endsWith(`/${PACKAGE_JSON3}`));
|
|
39315
39530
|
}
|
|
39316
39531
|
};
|
|
39317
39532
|
// src/migrate/ci-advisor.ts
|
|
39318
39533
|
var import_node_fs23 = require("node:fs");
|
|
39319
|
-
var
|
|
39534
|
+
var import_node_path37 = require("node:path");
|
|
39320
39535
|
var CI_PATTERNS = {
|
|
39321
39536
|
"semantic-release": [
|
|
39322
39537
|
/npx\s+semantic-release/,
|
|
@@ -39336,7 +39551,7 @@ var CI_PATTERNS = {
|
|
|
39336
39551
|
np: [/npx\s+np\b/, /yarn\s+np\b/]
|
|
39337
39552
|
};
|
|
39338
39553
|
function scanCiWorkflows(cwd, source) {
|
|
39339
|
-
const workflowsDir =
|
|
39554
|
+
const workflowsDir = import_node_path37.join(cwd, ".github", "workflows");
|
|
39340
39555
|
if (!import_node_fs23.existsSync(workflowsDir))
|
|
39341
39556
|
return [];
|
|
39342
39557
|
const patterns = CI_PATTERNS[source];
|
|
@@ -39345,7 +39560,7 @@ function scanCiWorkflows(cwd, source) {
|
|
|
39345
39560
|
for (const filename of files) {
|
|
39346
39561
|
if (!filename.endsWith(".yml") && !filename.endsWith(".yaml"))
|
|
39347
39562
|
continue;
|
|
39348
|
-
const filePath =
|
|
39563
|
+
const filePath = import_node_path37.join(workflowsDir, filename);
|
|
39349
39564
|
const content = import_node_fs23.readFileSync(filePath, "utf-8");
|
|
39350
39565
|
for (const line of content.split(`
|
|
39351
39566
|
`)) {
|
|
@@ -39588,7 +39803,7 @@ async function detectMigrationSources(cwd, adapters, from) {
|
|
|
39588
39803
|
}
|
|
39589
39804
|
// src/migrate/pipeline.ts
|
|
39590
39805
|
var import_node_fs25 = require("node:fs");
|
|
39591
|
-
var
|
|
39806
|
+
var import_node_path38 = require("node:path");
|
|
39592
39807
|
async function executeMigration(options) {
|
|
39593
39808
|
const { adapter, detected, cwd, dryRun, clean } = options;
|
|
39594
39809
|
const parsed = await adapter.parse(detected.configFiles, cwd);
|
|
@@ -39597,7 +39812,7 @@ async function executeMigration(options) {
|
|
|
39597
39812
|
const configString = generateConfigString(convertResult.config);
|
|
39598
39813
|
const ciAdvice = scanCiWorkflows(cwd, adapter.name);
|
|
39599
39814
|
if (!dryRun) {
|
|
39600
|
-
const outFile =
|
|
39815
|
+
const outFile = import_node_path38.join(cwd, "pubm.config.ts");
|
|
39601
39816
|
if (import_node_fs25.existsSync(outFile)) {
|
|
39602
39817
|
throw new Error("pubm.config.ts already exists. Remove or rename it before migrating.");
|
|
39603
39818
|
}
|
|
@@ -39662,12 +39877,12 @@ function topologicalSort(graph) {
|
|
|
39662
39877
|
return sorted.reverse();
|
|
39663
39878
|
}
|
|
39664
39879
|
// src/monorepo/groups.ts
|
|
39665
|
-
var
|
|
39880
|
+
var import_micromatch5 = __toESM(require_micromatch(), 1);
|
|
39666
39881
|
function resolveGroups(groups, allPackages) {
|
|
39667
39882
|
return groups.map((group) => {
|
|
39668
39883
|
const resolved = new Set;
|
|
39669
39884
|
for (const pattern of group) {
|
|
39670
|
-
const matches =
|
|
39885
|
+
const matches = import_micromatch5.default(allPackages, pattern);
|
|
39671
39886
|
for (const match of matches) {
|
|
39672
39887
|
resolved.add(match);
|
|
39673
39888
|
}
|
|
@@ -39864,7 +40079,7 @@ class ChangesetSource {
|
|
|
39864
40079
|
}
|
|
39865
40080
|
}
|
|
39866
40081
|
// src/version-source/conventional-commit-source.ts
|
|
39867
|
-
var
|
|
40082
|
+
var import_node_path39 = __toESM(require("node:path"));
|
|
39868
40083
|
class ConventionalCommitSource {
|
|
39869
40084
|
name = "conventional-commit";
|
|
39870
40085
|
typeOverrides;
|
|
@@ -39875,7 +40090,7 @@ class ConventionalCommitSource {
|
|
|
39875
40090
|
const packagePaths = [...context.packages.keys()];
|
|
39876
40091
|
const recommendations = [];
|
|
39877
40092
|
for (const packagePath of packagePaths) {
|
|
39878
|
-
const packageName =
|
|
40093
|
+
const packageName = import_node_path39.default.basename(packagePath);
|
|
39879
40094
|
const ref = findLastReleaseRef(context.cwd, packageName);
|
|
39880
40095
|
const rawCommits = getCommitsSinceRef(context.cwd, ref);
|
|
39881
40096
|
const parsed = [];
|
|
@@ -40621,33 +40836,33 @@ init_exec();
|
|
|
40621
40836
|
var import_child_process = require("child_process");
|
|
40622
40837
|
var import_child_process2 = require("child_process");
|
|
40623
40838
|
var import_fs = require("fs");
|
|
40624
|
-
var
|
|
40839
|
+
var import_promises9 = __toESM(require("fs/promises"));
|
|
40625
40840
|
var import_path = __toESM(require("path"));
|
|
40626
40841
|
var import_stream2 = require("stream");
|
|
40627
|
-
var
|
|
40842
|
+
var import_promises10 = require("stream/promises");
|
|
40628
40843
|
var import_util6 = require("util");
|
|
40629
|
-
var
|
|
40844
|
+
var import_promises11 = __toESM(require("fs/promises"));
|
|
40630
40845
|
var import_crypto2 = __toESM(require("crypto"));
|
|
40631
40846
|
var import_fs2 = require("fs");
|
|
40632
40847
|
var import_crypto3 = __toESM(require("crypto"));
|
|
40633
40848
|
var import_semver12 = __toESM(require_semver2(), 1);
|
|
40634
|
-
var
|
|
40849
|
+
var import_promises12 = __toESM(require("fs/promises"));
|
|
40635
40850
|
var import_path2 = __toESM(require("path"));
|
|
40636
40851
|
var import_semver13 = __toESM(require_semver2(), 1);
|
|
40637
40852
|
var import_semver14 = __toESM(require_semver2(), 1);
|
|
40638
|
-
var
|
|
40853
|
+
var import_promises13 = require("fs/promises");
|
|
40639
40854
|
var import_child_process3 = require("child_process");
|
|
40640
40855
|
var import_util7 = require("util");
|
|
40641
40856
|
var import_child_process4 = require("child_process");
|
|
40642
|
-
var
|
|
40857
|
+
var import_promises14 = require("fs/promises");
|
|
40643
40858
|
var import_util8 = require("util");
|
|
40644
|
-
var
|
|
40859
|
+
var import_promises15 = require("fs/promises");
|
|
40645
40860
|
var import_os2 = require("os");
|
|
40646
40861
|
var import_path3 = require("path");
|
|
40647
40862
|
var import_os3 = __toESM(require("os"));
|
|
40648
40863
|
var import_path4 = __toESM(require("path"));
|
|
40649
40864
|
var import_fs3 = require("fs");
|
|
40650
|
-
var
|
|
40865
|
+
var import_promises16 = require("fs/promises");
|
|
40651
40866
|
var import_path5 = require("path");
|
|
40652
40867
|
var import_url = require("url");
|
|
40653
40868
|
var DEFAULT_CHECK_INTERVAL_MS = 72000000;
|
|
@@ -40842,7 +41057,7 @@ function isBrewAlreadyInstalled(stdout, stderr) {
|
|
|
40842
41057
|
}
|
|
40843
41058
|
async function atomicReplace(newPath, targetPath) {
|
|
40844
41059
|
try {
|
|
40845
|
-
await
|
|
41060
|
+
await import_promises11.default.access(targetPath, import_promises11.default.constants.W_OK);
|
|
40846
41061
|
} catch {
|
|
40847
41062
|
throw new UpdateKitError(PERMISSION_DENIED, `No write permission: ${targetPath}. Run with appropriate permissions.`);
|
|
40848
41063
|
}
|
|
@@ -40855,12 +41070,12 @@ async function atomicReplace(newPath, targetPath) {
|
|
|
40855
41070
|
async function unixReplace(newPath, targetPath) {
|
|
40856
41071
|
const tmpInPlace = `${targetPath}.new.${process.pid}`;
|
|
40857
41072
|
try {
|
|
40858
|
-
await
|
|
40859
|
-
await
|
|
40860
|
-
await
|
|
41073
|
+
await import_promises11.default.copyFile(newPath, tmpInPlace);
|
|
41074
|
+
await import_promises11.default.chmod(tmpInPlace, 493);
|
|
41075
|
+
await import_promises11.default.rename(tmpInPlace, targetPath);
|
|
40861
41076
|
} catch (error4) {
|
|
40862
41077
|
try {
|
|
40863
|
-
await
|
|
41078
|
+
await import_promises11.default.unlink(tmpInPlace);
|
|
40864
41079
|
} catch {}
|
|
40865
41080
|
throw error4;
|
|
40866
41081
|
}
|
|
@@ -40868,21 +41083,21 @@ async function unixReplace(newPath, targetPath) {
|
|
|
40868
41083
|
async function windowsReplace(newPath, targetPath) {
|
|
40869
41084
|
const backupPath = `${targetPath}.old`;
|
|
40870
41085
|
try {
|
|
40871
|
-
await
|
|
41086
|
+
await import_promises11.default.unlink(backupPath);
|
|
40872
41087
|
} catch {}
|
|
40873
|
-
await
|
|
41088
|
+
await import_promises11.default.rename(targetPath, backupPath);
|
|
40874
41089
|
try {
|
|
40875
|
-
await
|
|
41090
|
+
await import_promises11.default.copyFile(newPath, targetPath);
|
|
40876
41091
|
} catch (copyError) {
|
|
40877
41092
|
try {
|
|
40878
|
-
await
|
|
41093
|
+
await import_promises11.default.rename(backupPath, targetPath);
|
|
40879
41094
|
} catch (rollbackError) {
|
|
40880
41095
|
throw new UpdateKitError(APPLY_FAILED, `Update failed and rollback also failed. Original binary may be at ${backupPath}. Copy error: ${copyError instanceof Error ? copyError.message : String(copyError)}. Rollback error: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}.`);
|
|
40881
41096
|
}
|
|
40882
41097
|
throw copyError;
|
|
40883
41098
|
}
|
|
40884
41099
|
try {
|
|
40885
|
-
await
|
|
41100
|
+
await import_promises11.default.unlink(backupPath);
|
|
40886
41101
|
} catch {}
|
|
40887
41102
|
}
|
|
40888
41103
|
async function fetchWithTimeout(url, options = {}) {
|
|
@@ -41067,12 +41282,12 @@ async function downloadArtifact(url, tmpDir, options) {
|
|
|
41067
41282
|
totalBytes
|
|
41068
41283
|
});
|
|
41069
41284
|
});
|
|
41070
|
-
await
|
|
41285
|
+
await import_promises10.pipeline(nodeStream, writeStream);
|
|
41071
41286
|
return destPath;
|
|
41072
41287
|
}
|
|
41073
41288
|
async function extractBinary(archivePath, tmpDir) {
|
|
41074
41289
|
const extractDir = import_path.default.join(tmpDir, "extracted");
|
|
41075
|
-
await
|
|
41290
|
+
await import_promises9.default.mkdir(extractDir, { recursive: true });
|
|
41076
41291
|
if (archivePath.endsWith(".tar.gz") || archivePath.endsWith(".tgz")) {
|
|
41077
41292
|
try {
|
|
41078
41293
|
await execFileAsync("tar", ["xzf", archivePath, "-C", extractDir]);
|
|
@@ -41099,14 +41314,14 @@ async function extractBinary(archivePath, tmpDir) {
|
|
|
41099
41314
|
}
|
|
41100
41315
|
} else {
|
|
41101
41316
|
const destPath = import_path.default.join(extractDir, import_path.default.basename(archivePath));
|
|
41102
|
-
await
|
|
41317
|
+
await import_promises9.default.copyFile(archivePath, destPath);
|
|
41103
41318
|
return destPath;
|
|
41104
41319
|
}
|
|
41105
41320
|
return findBinaryInDir(extractDir);
|
|
41106
41321
|
}
|
|
41107
41322
|
async function findBinaryInDir(dir) {
|
|
41108
|
-
const resolvedDir = await
|
|
41109
|
-
const entries = await
|
|
41323
|
+
const resolvedDir = await import_promises9.default.realpath(dir);
|
|
41324
|
+
const entries = await import_promises9.default.readdir(dir, {
|
|
41110
41325
|
withFileTypes: true,
|
|
41111
41326
|
recursive: true
|
|
41112
41327
|
});
|
|
@@ -41117,7 +41332,7 @@ async function findBinaryInDir(dir) {
|
|
|
41117
41332
|
const parentDir = e3.parentPath ?? ("path" in e3 ? e3.path : dir);
|
|
41118
41333
|
const filePath = import_path.default.join(parentDir, e3.name);
|
|
41119
41334
|
try {
|
|
41120
|
-
const resolvedFile = await
|
|
41335
|
+
const resolvedFile = await import_promises9.default.realpath(filePath);
|
|
41121
41336
|
if (!resolvedFile.startsWith(resolvedDir + import_path.default.sep) && resolvedFile !== resolvedDir) {
|
|
41122
41337
|
continue;
|
|
41123
41338
|
}
|
|
@@ -41134,7 +41349,7 @@ async function findBinaryInDir(dir) {
|
|
|
41134
41349
|
}
|
|
41135
41350
|
for (const file of files) {
|
|
41136
41351
|
try {
|
|
41137
|
-
await
|
|
41352
|
+
await import_promises9.default.access(file, import_promises9.default.constants.X_OK);
|
|
41138
41353
|
return file;
|
|
41139
41354
|
} catch {}
|
|
41140
41355
|
}
|
|
@@ -41166,16 +41381,16 @@ function extractFilename(url) {
|
|
|
41166
41381
|
async function createTempDir(targetPath) {
|
|
41167
41382
|
const targetDir = import_path.default.dirname(targetPath);
|
|
41168
41383
|
const tmpDir = import_path.default.join(targetDir, `.update-kit-tmp-${process.pid}-${Date.now()}`);
|
|
41169
|
-
await
|
|
41384
|
+
await import_promises9.default.mkdir(tmpDir, { recursive: true });
|
|
41170
41385
|
return tmpDir;
|
|
41171
41386
|
}
|
|
41172
41387
|
async function cleanupTempDir(tmpDir) {
|
|
41173
41388
|
try {
|
|
41174
|
-
await
|
|
41389
|
+
await import_promises9.default.rm(tmpDir, { recursive: true, force: true });
|
|
41175
41390
|
} catch {}
|
|
41176
41391
|
}
|
|
41177
41392
|
async function setExecutablePermission(filePath) {
|
|
41178
|
-
await
|
|
41393
|
+
await import_promises9.default.chmod(filePath, 493);
|
|
41179
41394
|
}
|
|
41180
41395
|
function getCachePath(cacheDir, appName) {
|
|
41181
41396
|
return import_path2.default.join(cacheDir, appName, "update-check.json");
|
|
@@ -41183,7 +41398,7 @@ function getCachePath(cacheDir, appName) {
|
|
|
41183
41398
|
async function readCache(cacheDir, appName) {
|
|
41184
41399
|
const filePath = getCachePath(cacheDir, appName);
|
|
41185
41400
|
try {
|
|
41186
|
-
const raw = await
|
|
41401
|
+
const raw = await import_promises12.default.readFile(filePath, "utf-8");
|
|
41187
41402
|
const parsed = JSON.parse(raw);
|
|
41188
41403
|
if (typeof parsed.latestVersion !== "string" || typeof parsed.currentVersionAtCheck !== "string" || typeof parsed.lastCheckedAt !== "string" || typeof parsed.source !== "string") {
|
|
41189
41404
|
return null;
|
|
@@ -41199,16 +41414,16 @@ async function readCache(cacheDir, appName) {
|
|
|
41199
41414
|
async function writeCache(cacheDir, appName, entry) {
|
|
41200
41415
|
const filePath = getCachePath(cacheDir, appName);
|
|
41201
41416
|
const dir = import_path2.default.dirname(filePath);
|
|
41202
|
-
await
|
|
41417
|
+
await import_promises12.default.mkdir(dir, { recursive: true });
|
|
41203
41418
|
const tmpPath = `${filePath}.${process.pid}-${Date.now()}.tmp`;
|
|
41204
41419
|
try {
|
|
41205
41420
|
const data = `${JSON.stringify(entry, null, 2)}
|
|
41206
41421
|
`;
|
|
41207
|
-
await
|
|
41208
|
-
await
|
|
41422
|
+
await import_promises12.default.writeFile(tmpPath, data, "utf-8");
|
|
41423
|
+
await import_promises12.default.rename(tmpPath, filePath);
|
|
41209
41424
|
} catch (error4) {
|
|
41210
41425
|
try {
|
|
41211
|
-
await
|
|
41426
|
+
await import_promises12.default.unlink(tmpPath);
|
|
41212
41427
|
} catch {}
|
|
41213
41428
|
throw new UpdateKitError(CACHE_ERROR, `Failed to write cache for ${appName}: ${error4 instanceof Error ? error4.message : String(error4)}`, { cause: error4 instanceof Error ? error4 : undefined });
|
|
41214
41429
|
}
|
|
@@ -41892,9 +42107,9 @@ async function detectFromNpm(execPath) {
|
|
|
41892
42107
|
}
|
|
41893
42108
|
} catch {}
|
|
41894
42109
|
try {
|
|
41895
|
-
const stats = await
|
|
42110
|
+
const stats = await import_promises14.lstat(execPath);
|
|
41896
42111
|
if (stats.isSymbolicLink()) {
|
|
41897
|
-
const target = await
|
|
42112
|
+
const target = await import_promises14.readlink(execPath);
|
|
41898
42113
|
if (target.includes("node_modules")) {
|
|
41899
42114
|
evidence.push({
|
|
41900
42115
|
source: "symlink",
|
|
@@ -41917,7 +42132,7 @@ async function detectFromReceipt(config, receiptDir) {
|
|
|
41917
42132
|
const dir = receiptDir ?? import_path3.join(import_os2.homedir(), ".config", config.appName);
|
|
41918
42133
|
const receiptPath = import_path3.join(dir, "install-receipt.json");
|
|
41919
42134
|
try {
|
|
41920
|
-
const content = await
|
|
42135
|
+
const content = await import_promises15.readFile(receiptPath, "utf-8");
|
|
41921
42136
|
const receipt = JSON.parse(content);
|
|
41922
42137
|
if (receipt.appName !== config.appName) {
|
|
41923
42138
|
return null;
|
|
@@ -41939,7 +42154,7 @@ async function detectFromReceipt(config, receiptDir) {
|
|
|
41939
42154
|
async function detectInstall(execPath, config) {
|
|
41940
42155
|
let resolvedPath;
|
|
41941
42156
|
try {
|
|
41942
|
-
resolvedPath = await
|
|
42157
|
+
resolvedPath = await import_promises13.realpath(execPath);
|
|
41943
42158
|
} catch {
|
|
41944
42159
|
resolvedPath = execPath;
|
|
41945
42160
|
}
|
|
@@ -42210,7 +42425,7 @@ async function findPackageJson(startDir) {
|
|
|
42210
42425
|
for (;; ) {
|
|
42211
42426
|
const candidate = import_path5.join(current, "package.json");
|
|
42212
42427
|
try {
|
|
42213
|
-
const content = await
|
|
42428
|
+
const content = await import_promises16.readFile(candidate, "utf-8");
|
|
42214
42429
|
const result = parsePackageJson(content, candidate);
|
|
42215
42430
|
if (result)
|
|
42216
42431
|
return result;
|
|
@@ -42637,10 +42852,10 @@ init_ui();
|
|
|
42637
42852
|
|
|
42638
42853
|
// src/validate/entry-points.ts
|
|
42639
42854
|
var import_node_fs26 = require("node:fs");
|
|
42640
|
-
var
|
|
42855
|
+
var import_node_path40 = __toESM(require("node:path"));
|
|
42641
42856
|
var SIMPLE_FIELDS = ["main", "module", "types", "typings"];
|
|
42642
42857
|
function checkPath(filePath, cwd) {
|
|
42643
|
-
return import_node_fs26.existsSync(
|
|
42858
|
+
return import_node_fs26.existsSync(import_node_path40.default.resolve(cwd, filePath));
|
|
42644
42859
|
}
|
|
42645
42860
|
function validateExports(exports2, cwd, prefix = "exports") {
|
|
42646
42861
|
const errors = [];
|
|
@@ -42690,7 +42905,7 @@ function validateEntryPoints(pkg, cwd) {
|
|
|
42690
42905
|
return errors;
|
|
42691
42906
|
}
|
|
42692
42907
|
// src/validate/extraneous-files.ts
|
|
42693
|
-
var
|
|
42908
|
+
var import_micromatch6 = __toESM(require_micromatch(), 1);
|
|
42694
42909
|
var PATTERNS = [
|
|
42695
42910
|
{
|
|
42696
42911
|
pattern: [".env", ".env.*"],
|
|
@@ -42728,7 +42943,7 @@ function detectExtraneousFiles(files) {
|
|
|
42728
42943
|
const seen = new Set;
|
|
42729
42944
|
for (const { pattern, reason, basename: basename4 } of PATTERNS) {
|
|
42730
42945
|
const options = basename4 ? { basename: true } : {};
|
|
42731
|
-
const matched =
|
|
42946
|
+
const matched = import_micromatch6.default(files, pattern, options);
|
|
42732
42947
|
for (const file of matched) {
|
|
42733
42948
|
if (!seen.has(file)) {
|
|
42734
42949
|
seen.add(file);
|