@pubm/core 0.4.1 → 0.4.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/assets/compressor.d.ts +1 -1
- package/dist/assets/compressor.d.ts.map +1 -1
- package/dist/assets/pipeline.d.ts.map +1 -1
- package/dist/index.cjs +119 -112
- package/dist/index.js +16 -9
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompressFormat, CompressOption } from "./types.js";
|
|
2
2
|
export declare function isKnownArchive(filePath: string): boolean;
|
|
3
3
|
export declare function resolveCompressFormat(filePath: string, os: string | undefined, option: CompressOption | undefined): CompressFormat | false;
|
|
4
|
-
export declare function compressFile(filePath: string, outDir: string, format: CompressFormat, extraFiles?: string[]): Promise<string>;
|
|
4
|
+
export declare function compressFile(filePath: string, outDir: string, format: CompressFormat, extraFiles?: string[], archiveBaseName?: string): Promise<string>;
|
|
5
5
|
//# sourceMappingURL=compressor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compressor.d.ts","sourceRoot":"","sources":["../../src/assets/compressor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAwBjE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMxD;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,MAAM,EAAE,cAAc,GAAG,SAAS,GACjC,cAAc,GAAG,KAAK,CAYxB;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,UAAU,CAAC,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"compressor.d.ts","sourceRoot":"","sources":["../../src/assets/compressor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAwBjE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMxD;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,MAAM,EAAE,cAAc,GAAG,SAAS,GACjC,cAAc,GAAG,KAAK,CAYxB;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,UAAU,CAAC,EAAE,MAAM,EAAE,EACrB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CA0DjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/assets/pipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/assets/pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,kBAAkB,EAElB,aAAa,EACb,aAAa,EAEd,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,aAAa,EAAE,EACzB,KAAK,EAAE,kBAAkB,EACzB,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,aAAa,EAAE,CAAC,CA+C1B"}
|
package/dist/index.cjs
CHANGED
|
@@ -20365,7 +20365,7 @@ class PluginRunner {
|
|
|
20365
20365
|
// src/tasks/runner.ts
|
|
20366
20366
|
var import_node_fs8 = require("node:fs");
|
|
20367
20367
|
var import_node_os4 = require("node:os");
|
|
20368
|
-
var
|
|
20368
|
+
var import_node_path16 = __toESM(require("node:path"));
|
|
20369
20369
|
var import_node_process15 = __toESM(require("node:process"));
|
|
20370
20370
|
var import_node_util3 = require("node:util");
|
|
20371
20371
|
|
|
@@ -22350,6 +22350,9 @@ function I() {
|
|
|
22350
22350
|
var L = I();
|
|
22351
22351
|
var R = L?.name || ``;
|
|
22352
22352
|
|
|
22353
|
+
// src/assets/pipeline.ts
|
|
22354
|
+
var import_node_path3 = require("node:path");
|
|
22355
|
+
|
|
22353
22356
|
// src/assets/compressor.ts
|
|
22354
22357
|
init_exec();
|
|
22355
22358
|
var import_node_fs = require("node:fs");
|
|
@@ -22396,10 +22399,11 @@ function resolveCompressFormat(filePath, os, option) {
|
|
|
22396
22399
|
return "zip";
|
|
22397
22400
|
return "tar.gz";
|
|
22398
22401
|
}
|
|
22399
|
-
async function compressFile(filePath, outDir, format2, extraFiles) {
|
|
22402
|
+
async function compressFile(filePath, outDir, format2, extraFiles, archiveBaseName) {
|
|
22400
22403
|
const file = import_node_path.basename(filePath);
|
|
22401
22404
|
const dir = import_node_path.join(filePath, "..");
|
|
22402
|
-
const
|
|
22405
|
+
const stem = archiveBaseName ?? import_node_path.basename(filePath, import_node_path.extname(filePath));
|
|
22406
|
+
const archiveName = `${stem}.${format2}`;
|
|
22403
22407
|
const archivePath = import_node_path.join(outDir, archiveName);
|
|
22404
22408
|
const allFiles = [file, ...extraFiles?.map((f2) => import_node_path.basename(f2)) ?? []];
|
|
22405
22409
|
switch (format2) {
|
|
@@ -22543,7 +22547,10 @@ async function defaultCompress(asset, tempDir) {
|
|
|
22543
22547
|
config
|
|
22544
22548
|
};
|
|
22545
22549
|
}
|
|
22546
|
-
const
|
|
22550
|
+
const stem = import_node_path3.basename(filePath, import_node_path3.extname(filePath));
|
|
22551
|
+
const platformSuffix = platform2.raw ? `-${platform2.raw}` : "";
|
|
22552
|
+
const archiveBaseName = `${stem}${platformSuffix}`;
|
|
22553
|
+
const archivePath = await compressFile(filePath, tempDir, config.compress, asset.extraFiles, archiveBaseName);
|
|
22547
22554
|
return {
|
|
22548
22555
|
filePath: archivePath,
|
|
22549
22556
|
originalPath: filePath,
|
|
@@ -22555,7 +22562,7 @@ async function defaultCompress(asset, tempDir) {
|
|
|
22555
22562
|
|
|
22556
22563
|
// src/assets/resolver.ts
|
|
22557
22564
|
var import_node_fs2 = require("node:fs");
|
|
22558
|
-
var
|
|
22565
|
+
var import_node_path4 = require("node:path");
|
|
22559
22566
|
var import_micromatch = __toESM(require_micromatch(), 1);
|
|
22560
22567
|
|
|
22561
22568
|
// src/assets/platform-parser.ts
|
|
@@ -22728,16 +22735,16 @@ function extractCaptureVars(pattern, actualPath) {
|
|
|
22728
22735
|
}
|
|
22729
22736
|
function scanGlob(baseDir, pattern) {
|
|
22730
22737
|
const files = collectFiles(baseDir, baseDir);
|
|
22731
|
-
const relativePaths = files.map((f2) =>
|
|
22738
|
+
const relativePaths = files.map((f2) => import_node_path4.relative(baseDir, f2));
|
|
22732
22739
|
const matched = import_micromatch.default(relativePaths, pattern);
|
|
22733
|
-
return matched.map((rel) =>
|
|
22740
|
+
return matched.map((rel) => import_node_path4.resolve(baseDir, rel));
|
|
22734
22741
|
}
|
|
22735
22742
|
function collectFiles(dir, root) {
|
|
22736
22743
|
const results = [];
|
|
22737
22744
|
try {
|
|
22738
22745
|
const entries = import_node_fs2.readdirSync(dir, { withFileTypes: true });
|
|
22739
22746
|
for (const entry of entries) {
|
|
22740
|
-
const full =
|
|
22747
|
+
const full = import_node_path4.join(dir, entry.name);
|
|
22741
22748
|
if (entry.isDirectory()) {
|
|
22742
22749
|
results.push(...collectFiles(full, root));
|
|
22743
22750
|
} else {
|
|
@@ -22751,10 +22758,10 @@ function resolveAssets(config, globalCompress, cwd) {
|
|
|
22751
22758
|
const results = [];
|
|
22752
22759
|
for (const file of config.files) {
|
|
22753
22760
|
const globPattern = pathPatternToGlob(file.path);
|
|
22754
|
-
const baseDir =
|
|
22761
|
+
const baseDir = import_node_path4.resolve(cwd, config.packagePath ?? "");
|
|
22755
22762
|
const matches = scanGlob(baseDir, globPattern);
|
|
22756
22763
|
for (const matchPath of matches) {
|
|
22757
|
-
const relPath =
|
|
22764
|
+
const relPath = import_node_path4.relative(baseDir, matchPath).replace(/\\/g, "/");
|
|
22758
22765
|
const capturedVars = extractCaptureVars(file.path, relPath);
|
|
22759
22766
|
let platform2;
|
|
22760
22767
|
if (Object.keys(capturedVars).length > 0) {
|
|
@@ -22795,7 +22802,7 @@ function resolveAssets(config, globalCompress, cwd) {
|
|
|
22795
22802
|
|
|
22796
22803
|
// src/changeset/changelog.ts
|
|
22797
22804
|
var import_node_fs3 = require("node:fs");
|
|
22798
|
-
var
|
|
22805
|
+
var import_node_path5 = __toESM(require("node:path"));
|
|
22799
22806
|
var SECTION_ORDER = [
|
|
22800
22807
|
{ type: "major", heading: "Major Changes" },
|
|
22801
22808
|
{ type: "minor", heading: "Minor Changes" },
|
|
@@ -22842,7 +22849,7 @@ function buildChangelogEntries(changesets, packageName) {
|
|
|
22842
22849
|
return entries;
|
|
22843
22850
|
}
|
|
22844
22851
|
function writeChangelogToFile(cwd, newContent) {
|
|
22845
|
-
const changelogPath =
|
|
22852
|
+
const changelogPath = import_node_path5.default.join(cwd, "CHANGELOG.md");
|
|
22846
22853
|
let existing = "";
|
|
22847
22854
|
if (import_node_fs3.existsSync(changelogPath)) {
|
|
22848
22855
|
existing = import_node_fs3.readFileSync(changelogPath, "utf-8");
|
|
@@ -22875,7 +22882,7 @@ function parseChangelogSection(changelog, version) {
|
|
|
22875
22882
|
|
|
22876
22883
|
// src/changeset/reader.ts
|
|
22877
22884
|
var import_node_fs4 = require("node:fs");
|
|
22878
|
-
var
|
|
22885
|
+
var import_node_path6 = __toESM(require("node:path"));
|
|
22879
22886
|
var import_node_process5 = __toESM(require("node:process"));
|
|
22880
22887
|
|
|
22881
22888
|
// src/changeset/parser.ts
|
|
@@ -22909,7 +22916,7 @@ function parseChangeset(content, fileName) {
|
|
|
22909
22916
|
|
|
22910
22917
|
// src/changeset/reader.ts
|
|
22911
22918
|
function readChangesets(cwd = import_node_process5.default.cwd()) {
|
|
22912
|
-
const changesetsDir =
|
|
22919
|
+
const changesetsDir = import_node_path6.default.join(cwd, ".pubm", "changesets");
|
|
22913
22920
|
if (!import_node_fs4.existsSync(changesetsDir)) {
|
|
22914
22921
|
return [];
|
|
22915
22922
|
}
|
|
@@ -22919,16 +22926,16 @@ function readChangesets(cwd = import_node_process5.default.cwd()) {
|
|
|
22919
22926
|
if (!file.endsWith(".md") || file === "README.md") {
|
|
22920
22927
|
continue;
|
|
22921
22928
|
}
|
|
22922
|
-
const filePath =
|
|
22929
|
+
const filePath = import_node_path6.default.join(changesetsDir, file);
|
|
22923
22930
|
const content = import_node_fs4.readFileSync(filePath, "utf-8");
|
|
22924
22931
|
changesets.push(parseChangeset(content, file));
|
|
22925
22932
|
}
|
|
22926
22933
|
return changesets;
|
|
22927
22934
|
}
|
|
22928
22935
|
function deleteChangesetFiles(cwd, changesets) {
|
|
22929
|
-
const changesetsDir =
|
|
22936
|
+
const changesetsDir = import_node_path6.default.join(cwd, ".pubm", "changesets");
|
|
22930
22937
|
for (const changeset of changesets) {
|
|
22931
|
-
const filePath =
|
|
22938
|
+
const filePath = import_node_path6.default.join(changesetsDir, `${changeset.id}.md`);
|
|
22932
22939
|
if (import_node_fs4.existsSync(filePath)) {
|
|
22933
22940
|
import_node_fs4.rmSync(filePath);
|
|
22934
22941
|
}
|
|
@@ -22937,7 +22944,7 @@ function deleteChangesetFiles(cwd, changesets) {
|
|
|
22937
22944
|
|
|
22938
22945
|
// src/ecosystem/js.ts
|
|
22939
22946
|
var import_promises4 = require("node:fs/promises");
|
|
22940
|
-
var
|
|
22947
|
+
var import_node_path11 = __toESM(require("node:path"));
|
|
22941
22948
|
|
|
22942
22949
|
// src/registry/jsr.ts
|
|
22943
22950
|
var import_node_process7 = __toESM(require("node:process"));
|
|
@@ -22945,7 +22952,7 @@ init_error();
|
|
|
22945
22952
|
|
|
22946
22953
|
// src/manifest/manifest-reader.ts
|
|
22947
22954
|
var import_promises2 = require("node:fs/promises");
|
|
22948
|
-
var
|
|
22955
|
+
var import_node_path7 = require("node:path");
|
|
22949
22956
|
|
|
22950
22957
|
class ManifestReader {
|
|
22951
22958
|
schema;
|
|
@@ -22957,7 +22964,7 @@ class ManifestReader {
|
|
|
22957
22964
|
const cached = this.cache.get(packagePath);
|
|
22958
22965
|
if (cached)
|
|
22959
22966
|
return cached;
|
|
22960
|
-
const raw = await import_promises2.readFile(
|
|
22967
|
+
const raw = await import_promises2.readFile(import_node_path7.join(packagePath, this.schema.file), "utf-8");
|
|
22961
22968
|
const parsed = this.schema.parser(raw);
|
|
22962
22969
|
const manifest = {
|
|
22963
22970
|
name: this.schema.fields.name(parsed),
|
|
@@ -22970,7 +22977,7 @@ class ManifestReader {
|
|
|
22970
22977
|
}
|
|
22971
22978
|
async exists(packagePath) {
|
|
22972
22979
|
try {
|
|
22973
|
-
const s2 = await import_promises2.stat(
|
|
22980
|
+
const s2 = await import_promises2.stat(import_node_path7.join(packagePath, this.schema.file));
|
|
22974
22981
|
return s2.isFile();
|
|
22975
22982
|
} catch {
|
|
22976
22983
|
return false;
|
|
@@ -23040,7 +23047,7 @@ function isValidPackageName(packageName) {
|
|
|
23040
23047
|
// package.json
|
|
23041
23048
|
var package_default = {
|
|
23042
23049
|
name: "@pubm/core",
|
|
23043
|
-
version: "0.4.
|
|
23050
|
+
version: "0.4.2",
|
|
23044
23051
|
type: "module",
|
|
23045
23052
|
description: "Core SDK for pubm - publish manager for multiple registries",
|
|
23046
23053
|
types: "./dist/index.d.ts",
|
|
@@ -23100,7 +23107,7 @@ var coreEngines = package_default.engines ?? {};
|
|
|
23100
23107
|
function resolveDefine(injected, fallback) {
|
|
23101
23108
|
return typeof injected === "string" ? injected : fallback;
|
|
23102
23109
|
}
|
|
23103
|
-
var PUBM_VERSION = resolveDefine("0.4.
|
|
23110
|
+
var PUBM_VERSION = resolveDefine("0.4.2", package_default.version);
|
|
23104
23111
|
var PUBM_ENGINES = {
|
|
23105
23112
|
node: resolveDefine(">=24", coreEngines.node ?? ">=18"),
|
|
23106
23113
|
git: resolveDefine(">=2.11.0", coreEngines.git ?? ">=2.11.0"),
|
|
@@ -23149,7 +23156,7 @@ var import_node_module2 = require("node:module");
|
|
|
23149
23156
|
var import_node_crypto2 = require("node:crypto");
|
|
23150
23157
|
var import_node_fs5 = require("node:fs");
|
|
23151
23158
|
var import_node_os2 = require("node:os");
|
|
23152
|
-
var
|
|
23159
|
+
var import_node_path8 = __toESM(require("node:path"));
|
|
23153
23160
|
var a2 = "aes-256-cbc";
|
|
23154
23161
|
var h2 = import_node_os2.homedir();
|
|
23155
23162
|
var n2 = import_node_fs5.statSync(h2);
|
|
@@ -23165,7 +23172,7 @@ function d2(g, h3) {
|
|
|
23165
23172
|
}
|
|
23166
23173
|
|
|
23167
23174
|
class Db {
|
|
23168
|
-
path =
|
|
23175
|
+
path = import_node_path8.default.resolve(h2, ".pubm");
|
|
23169
23176
|
constructor() {
|
|
23170
23177
|
try {
|
|
23171
23178
|
if (!import_node_fs5.statSync(this.path).isDirectory()) {
|
|
@@ -23181,13 +23188,13 @@ class Db {
|
|
|
23181
23188
|
}
|
|
23182
23189
|
set(field, value) {
|
|
23183
23190
|
try {
|
|
23184
|
-
import_node_fs5.writeFileSync(
|
|
23191
|
+
import_node_fs5.writeFileSync(import_node_path8.default.resolve(this.path, Buffer.from(e2(field, field)).toString("base64")), Buffer.from(e2(`${value}`, field)), { encoding: "binary" });
|
|
23185
23192
|
} catch (error2) {
|
|
23186
23193
|
throw new Error(`Failed to save token for '${field}': ${error2 instanceof Error ? error2.message : error2}`);
|
|
23187
23194
|
}
|
|
23188
23195
|
}
|
|
23189
23196
|
get(field) {
|
|
23190
|
-
const filePath =
|
|
23197
|
+
const filePath = import_node_path8.default.resolve(this.path, Buffer.from(e2(field, field)).toString("base64"));
|
|
23191
23198
|
let raw;
|
|
23192
23199
|
try {
|
|
23193
23200
|
raw = import_node_fs5.readFileSync(filePath);
|
|
@@ -23201,7 +23208,7 @@ class Db {
|
|
|
23201
23208
|
}
|
|
23202
23209
|
}
|
|
23203
23210
|
delete(field) {
|
|
23204
|
-
const filePath =
|
|
23211
|
+
const filePath = import_node_path8.default.resolve(this.path, Buffer.from(e2(field, field)).toString("base64"));
|
|
23205
23212
|
try {
|
|
23206
23213
|
import_node_fs5.unlinkSync(filePath);
|
|
23207
23214
|
} catch {}
|
|
@@ -23749,7 +23756,7 @@ async function jsrPackageRegistry(packagePath) {
|
|
|
23749
23756
|
|
|
23750
23757
|
// src/registry/npm.ts
|
|
23751
23758
|
var import_node_os3 = require("node:os");
|
|
23752
|
-
var
|
|
23759
|
+
var import_node_path9 = require("node:path");
|
|
23753
23760
|
var import_node_process9 = __toESM(require("node:process"));
|
|
23754
23761
|
init_error();
|
|
23755
23762
|
init_exec();
|
|
@@ -23929,7 +23936,7 @@ class NpmPackageRegistry extends PackageRegistry {
|
|
|
23929
23936
|
cwd: this.packagePath,
|
|
23930
23937
|
env: {
|
|
23931
23938
|
...import_node_process9.default.env,
|
|
23932
|
-
npm_config_cache:
|
|
23939
|
+
npm_config_cache: import_node_path9.join(import_node_os3.tmpdir(), "pubm-npm-cache")
|
|
23933
23940
|
}
|
|
23934
23941
|
}
|
|
23935
23942
|
});
|
|
@@ -24059,20 +24066,20 @@ async function npmPackageRegistry(packagePath) {
|
|
|
24059
24066
|
|
|
24060
24067
|
// src/utils/package.ts
|
|
24061
24068
|
var import_promises3 = require("node:fs/promises");
|
|
24062
|
-
var
|
|
24069
|
+
var import_node_path10 = __toESM(require("node:path"));
|
|
24063
24070
|
var import_node_process10 = __toESM(require("node:process"));
|
|
24064
24071
|
async function findOutFile(file, { cwd = import_node_process10.default.cwd() } = {}) {
|
|
24065
24072
|
let directory = cwd;
|
|
24066
24073
|
let filePath = "";
|
|
24067
|
-
const { root } =
|
|
24074
|
+
const { root } = import_node_path10.default.parse(cwd);
|
|
24068
24075
|
while (directory) {
|
|
24069
|
-
filePath =
|
|
24076
|
+
filePath = import_node_path10.default.join(directory, file);
|
|
24070
24077
|
try {
|
|
24071
24078
|
if ((await import_promises3.stat(filePath)).isFile()) {
|
|
24072
24079
|
break;
|
|
24073
24080
|
}
|
|
24074
24081
|
} catch {}
|
|
24075
|
-
directory =
|
|
24082
|
+
directory = import_node_path10.default.dirname(directory);
|
|
24076
24083
|
if (directory === root)
|
|
24077
24084
|
return null;
|
|
24078
24085
|
}
|
|
@@ -24159,7 +24166,7 @@ class JsEcosystem extends Ecosystem {
|
|
|
24159
24166
|
async writeVersion(newVersion) {
|
|
24160
24167
|
const files = ["package.json", "jsr.json"];
|
|
24161
24168
|
for (const file of files) {
|
|
24162
|
-
const filePath =
|
|
24169
|
+
const filePath = import_node_path11.default.join(this.packagePath, file);
|
|
24163
24170
|
try {
|
|
24164
24171
|
const content = await import_promises4.readFile(filePath, "utf-8");
|
|
24165
24172
|
await import_promises4.writeFile(filePath, content.replace(versionRegex, `$1${newVersion}$2`));
|
|
@@ -24187,7 +24194,7 @@ class JsEcosystem extends Ecosystem {
|
|
|
24187
24194
|
|
|
24188
24195
|
// src/ecosystem/rust.ts
|
|
24189
24196
|
var import_promises5 = require("node:fs/promises");
|
|
24190
|
-
var
|
|
24197
|
+
var import_node_path13 = __toESM(require("node:path"));
|
|
24191
24198
|
|
|
24192
24199
|
// ../../node_modules/.bun/smol-toml@1.6.0/node_modules/smol-toml/dist/error.js
|
|
24193
24200
|
/*!
|
|
@@ -25276,7 +25283,7 @@ function stringify(obj, { maxDepth = 1000, numbersAsFloat = false } = {}) {
|
|
|
25276
25283
|
*/
|
|
25277
25284
|
|
|
25278
25285
|
// src/registry/crates.ts
|
|
25279
|
-
var
|
|
25286
|
+
var import_node_path12 = __toESM(require("node:path"));
|
|
25280
25287
|
var import_node_process11 = __toESM(require("node:process"));
|
|
25281
25288
|
init_error();
|
|
25282
25289
|
init_exec();
|
|
@@ -25386,7 +25393,7 @@ class CratesPackageRegistry extends PackageRegistry {
|
|
|
25386
25393
|
try {
|
|
25387
25394
|
const args = ["publish"];
|
|
25388
25395
|
if (this.packagePath) {
|
|
25389
|
-
args.push("--manifest-path",
|
|
25396
|
+
args.push("--manifest-path", import_node_path12.default.join(this.packagePath, "Cargo.toml"));
|
|
25390
25397
|
}
|
|
25391
25398
|
await exec3("cargo", args, { throwOnError: true });
|
|
25392
25399
|
return true;
|
|
@@ -25401,7 +25408,7 @@ ${cleanCargoStderr(stderr)}` : "Failed to run `cargo publish`";
|
|
|
25401
25408
|
try {
|
|
25402
25409
|
const args = ["publish", "--dry-run"];
|
|
25403
25410
|
if (this.packagePath) {
|
|
25404
|
-
args.push("--manifest-path",
|
|
25411
|
+
args.push("--manifest-path", import_node_path12.default.join(this.packagePath, "Cargo.toml"));
|
|
25405
25412
|
}
|
|
25406
25413
|
await exec3("cargo", args, { throwOnError: true });
|
|
25407
25414
|
} catch (error2) {
|
|
@@ -25465,7 +25472,7 @@ class RustEcosystem extends Ecosystem {
|
|
|
25465
25472
|
return [CratesPackageRegistry];
|
|
25466
25473
|
}
|
|
25467
25474
|
async writeVersion(newVersion) {
|
|
25468
|
-
const filePath =
|
|
25475
|
+
const filePath = import_node_path13.default.join(this.packagePath, "Cargo.toml");
|
|
25469
25476
|
const raw = await import_promises5.readFile(filePath, "utf-8");
|
|
25470
25477
|
const cargo = parse(raw);
|
|
25471
25478
|
const pkg = cargo.package;
|
|
@@ -25473,7 +25480,7 @@ class RustEcosystem extends Ecosystem {
|
|
|
25473
25480
|
await import_promises5.writeFile(filePath, stringify(cargo));
|
|
25474
25481
|
}
|
|
25475
25482
|
async updateSiblingDependencyVersions(siblingVersions) {
|
|
25476
|
-
const filePath =
|
|
25483
|
+
const filePath = import_node_path13.default.join(this.packagePath, "Cargo.toml");
|
|
25477
25484
|
const raw = await import_promises5.readFile(filePath, "utf-8");
|
|
25478
25485
|
const cargo = parse(raw);
|
|
25479
25486
|
let modified = false;
|
|
@@ -25500,20 +25507,20 @@ class RustEcosystem extends Ecosystem {
|
|
|
25500
25507
|
return;
|
|
25501
25508
|
const name = await this.packageName();
|
|
25502
25509
|
await exec3("cargo", ["update", "--package", name], {
|
|
25503
|
-
nodeOptions: { cwd:
|
|
25510
|
+
nodeOptions: { cwd: import_node_path13.default.dirname(lockfilePath) }
|
|
25504
25511
|
});
|
|
25505
25512
|
return lockfilePath;
|
|
25506
25513
|
}
|
|
25507
25514
|
async findLockfile() {
|
|
25508
25515
|
let dir = this.packagePath;
|
|
25509
|
-
const { root } =
|
|
25516
|
+
const { root } = import_node_path13.default.parse(dir);
|
|
25510
25517
|
while (dir !== root) {
|
|
25511
|
-
const candidate =
|
|
25518
|
+
const candidate = import_node_path13.default.join(dir, "Cargo.lock");
|
|
25512
25519
|
try {
|
|
25513
25520
|
if ((await import_promises5.stat(candidate)).isFile())
|
|
25514
25521
|
return candidate;
|
|
25515
25522
|
} catch {}
|
|
25516
|
-
dir =
|
|
25523
|
+
dir = import_node_path13.default.dirname(dir);
|
|
25517
25524
|
}
|
|
25518
25525
|
return;
|
|
25519
25526
|
}
|
|
@@ -26600,10 +26607,10 @@ init_exec();
|
|
|
26600
26607
|
|
|
26601
26608
|
// src/utils/gh-secrets-sync-state.ts
|
|
26602
26609
|
var import_node_fs7 = require("node:fs");
|
|
26603
|
-
var
|
|
26610
|
+
var import_node_path14 = __toESM(require("node:path"));
|
|
26604
26611
|
var SYNC_HASH_FILENAME = "gh-secrets-sync-hash";
|
|
26605
26612
|
function syncHashFilePath() {
|
|
26606
|
-
return
|
|
26613
|
+
return import_node_path14.default.join(new Db().path, SYNC_HASH_FILENAME);
|
|
26607
26614
|
}
|
|
26608
26615
|
function readGhSecretsSyncHash() {
|
|
26609
26616
|
try {
|
|
@@ -26845,7 +26852,7 @@ var prerequisitesCheckTask = (options) => {
|
|
|
26845
26852
|
|
|
26846
26853
|
// src/tasks/required-conditions-check.ts
|
|
26847
26854
|
var import_promises6 = require("node:fs/promises");
|
|
26848
|
-
var
|
|
26855
|
+
var import_node_path15 = require("node:path");
|
|
26849
26856
|
init_error();
|
|
26850
26857
|
init_git();
|
|
26851
26858
|
|
|
@@ -26928,7 +26935,7 @@ var requiredConditionsCheckTask = (options) => {
|
|
|
26928
26935
|
title: "Checking if test and build scripts exist",
|
|
26929
26936
|
skip: (ctx) => !needsPackageScripts(collectRegistries(ctx.config)),
|
|
26930
26937
|
task: async (ctx) => {
|
|
26931
|
-
const raw = await import_promises6.readFile(
|
|
26938
|
+
const raw = await import_promises6.readFile(import_node_path15.join(ctx.cwd, "package.json"), "utf-8");
|
|
26932
26939
|
const { scripts } = JSON.parse(raw);
|
|
26933
26940
|
const errors = [];
|
|
26934
26941
|
if (!ctx.options.skipTests && !scripts?.[ctx.options.testScript]) {
|
|
@@ -26981,7 +26988,7 @@ async function prepareReleaseAssets(ctx, packageName, version, packagePath) {
|
|
|
26981
26988
|
const assetHooks = ctx.runtime.pluginRunner.collectAssetHooks();
|
|
26982
26989
|
const normalizedGroups = normalizeConfig(assetConfig, ctx.config.compress);
|
|
26983
26990
|
const relevantGroup = normalizedGroups.find((g) => !g.packagePath || g.packagePath === packagePath) ?? { files: [] };
|
|
26984
|
-
const tempDir =
|
|
26991
|
+
const tempDir = import_node_path16.join(import_node_os4.tmpdir(), `pubm-assets-${Date.now()}`);
|
|
26985
26992
|
import_node_fs8.mkdirSync(tempDir, { recursive: true });
|
|
26986
26993
|
ctx.runtime.tempDir = tempDir;
|
|
26987
26994
|
const resolvedAssets = resolveAssets(relevantGroup, ctx.config.compress, ctx.cwd);
|
|
@@ -26998,7 +27005,7 @@ function getPackageName(ctx, packagePath) {
|
|
|
26998
27005
|
}
|
|
26999
27006
|
async function writeVersions(ctx, versions) {
|
|
27000
27007
|
const ecosystems = ctx.config.packages.map((pkg) => {
|
|
27001
|
-
const absPath =
|
|
27008
|
+
const absPath = import_node_path16.default.resolve(ctx.cwd ?? import_node_process15.default.cwd(), pkg.path);
|
|
27002
27009
|
const descriptor = ecosystemCatalog.get(pkg.ecosystem);
|
|
27003
27010
|
if (!descriptor)
|
|
27004
27011
|
throw new Error(`Unknown ecosystem: ${pkg.ecosystem}`);
|
|
@@ -27006,7 +27013,7 @@ async function writeVersions(ctx, versions) {
|
|
|
27006
27013
|
return { eco, pkg };
|
|
27007
27014
|
});
|
|
27008
27015
|
const lockfileChanges = await writeVersionsForEcosystem(ecosystems, versions);
|
|
27009
|
-
const manifestFiles = ecosystems.flatMap(({ eco }) => eco.manifestFiles().map((f2) =>
|
|
27016
|
+
const manifestFiles = ecosystems.flatMap(({ eco }) => eco.manifestFiles().map((f2) => import_node_path16.default.resolve(eco.packagePath, f2)));
|
|
27010
27017
|
return [...manifestFiles, ...lockfileChanges];
|
|
27011
27018
|
}
|
|
27012
27019
|
var publishTaskMap = {
|
|
@@ -27376,7 +27383,7 @@ async function run(ctx) {
|
|
|
27376
27383
|
let changelogBody;
|
|
27377
27384
|
const pkgConfig = ctx2.config.packages.find((p2) => p2.path === pkgPath);
|
|
27378
27385
|
if (pkgConfig) {
|
|
27379
|
-
const changelogPath =
|
|
27386
|
+
const changelogPath = import_node_path16.join(import_node_process15.default.cwd(), pkgConfig.path, "CHANGELOG.md");
|
|
27380
27387
|
if (import_node_fs8.existsSync(changelogPath)) {
|
|
27381
27388
|
const section = parseChangelogSection(import_node_fs8.readFileSync(changelogPath, "utf-8"), pkgVersion);
|
|
27382
27389
|
if (section)
|
|
@@ -27422,7 +27429,7 @@ async function run(ctx) {
|
|
|
27422
27429
|
const pkgConfig = ctx2.config.packages.find((p2) => p2.path === pkgPath2);
|
|
27423
27430
|
if (!pkgConfig)
|
|
27424
27431
|
continue;
|
|
27425
|
-
const changelogPath =
|
|
27432
|
+
const changelogPath = import_node_path16.join(import_node_process15.default.cwd(), pkgConfig.path, "CHANGELOG.md");
|
|
27426
27433
|
if (import_node_fs8.existsSync(changelogPath)) {
|
|
27427
27434
|
const section = parseChangelogSection(import_node_fs8.readFileSync(changelogPath, "utf-8"), pkgVersion);
|
|
27428
27435
|
if (section) {
|
|
@@ -27440,7 +27447,7 @@ ${section}`);
|
|
|
27440
27447
|
`);
|
|
27441
27448
|
}
|
|
27442
27449
|
} else {
|
|
27443
|
-
const changelogPath =
|
|
27450
|
+
const changelogPath = import_node_path16.join(import_node_process15.default.cwd(), "CHANGELOG.md");
|
|
27444
27451
|
if (import_node_fs8.existsSync(changelogPath)) {
|
|
27445
27452
|
const section = parseChangelogSection(import_node_fs8.readFileSync(changelogPath, "utf-8"), version);
|
|
27446
27453
|
if (section)
|
|
@@ -27709,7 +27716,7 @@ ${section}`);
|
|
|
27709
27716
|
const entries = buildChangelogEntries(changesets, pkgName);
|
|
27710
27717
|
if (entries.length > 0) {
|
|
27711
27718
|
const pkgConfig = ctx2.config.packages.find((p2) => p2.path === pkgPath);
|
|
27712
|
-
const changelogDir = pkgConfig ?
|
|
27719
|
+
const changelogDir = pkgConfig ? import_node_path16.default.resolve(import_node_process15.default.cwd(), pkgConfig.path) : import_node_process15.default.cwd();
|
|
27713
27720
|
writeChangelogToFile(changelogDir, generateChangelog(pkgVersion, entries));
|
|
27714
27721
|
}
|
|
27715
27722
|
}
|
|
@@ -27913,11 +27920,11 @@ function maxBump(a3, b2) {
|
|
|
27913
27920
|
}
|
|
27914
27921
|
// src/changeset/migrate.ts
|
|
27915
27922
|
var import_node_fs9 = require("node:fs");
|
|
27916
|
-
var
|
|
27923
|
+
var import_node_path17 = __toESM(require("node:path"));
|
|
27917
27924
|
var import_node_process16 = __toESM(require("node:process"));
|
|
27918
27925
|
var SKIPPED_FILES = new Set(["config.json", "README.md"]);
|
|
27919
27926
|
function migrateFromChangesets(cwd = import_node_process16.default.cwd()) {
|
|
27920
|
-
const changesetDir =
|
|
27927
|
+
const changesetDir = import_node_path17.default.join(cwd, ".changeset");
|
|
27921
27928
|
if (!import_node_fs9.existsSync(changesetDir)) {
|
|
27922
27929
|
return {
|
|
27923
27930
|
success: false,
|
|
@@ -27926,7 +27933,7 @@ function migrateFromChangesets(cwd = import_node_process16.default.cwd()) {
|
|
|
27926
27933
|
configMigrated: false
|
|
27927
27934
|
};
|
|
27928
27935
|
}
|
|
27929
|
-
const pubmDir =
|
|
27936
|
+
const pubmDir = import_node_path17.default.join(cwd, ".pubm", "changesets");
|
|
27930
27937
|
import_node_fs9.mkdirSync(pubmDir, { recursive: true });
|
|
27931
27938
|
const files = import_node_fs9.readdirSync(changesetDir);
|
|
27932
27939
|
const migratedFiles = [];
|
|
@@ -27940,13 +27947,13 @@ function migrateFromChangesets(cwd = import_node_process16.default.cwd()) {
|
|
|
27940
27947
|
continue;
|
|
27941
27948
|
}
|
|
27942
27949
|
if (file === "pre.json") {
|
|
27943
|
-
import_node_fs9.copyFileSync(
|
|
27950
|
+
import_node_fs9.copyFileSync(import_node_path17.default.join(changesetDir, file), import_node_path17.default.resolve(cwd, ".pubm", "pre.json"));
|
|
27944
27951
|
migratedFiles.push(file);
|
|
27945
27952
|
continue;
|
|
27946
27953
|
}
|
|
27947
27954
|
if (file.endsWith(".md")) {
|
|
27948
|
-
const src =
|
|
27949
|
-
const dest =
|
|
27955
|
+
const src = import_node_path17.default.join(changesetDir, file);
|
|
27956
|
+
const dest = import_node_path17.default.join(pubmDir, file);
|
|
27950
27957
|
import_node_fs9.copyFileSync(src, dest);
|
|
27951
27958
|
migratedFiles.push(file);
|
|
27952
27959
|
}
|
|
@@ -28020,7 +28027,7 @@ function calculateVersionBumps(currentVersions, cwd = import_node_process18.defa
|
|
|
28020
28027
|
}
|
|
28021
28028
|
// src/changeset/writer.ts
|
|
28022
28029
|
var import_node_fs10 = require("node:fs");
|
|
28023
|
-
var
|
|
28030
|
+
var import_node_path18 = __toESM(require("node:path"));
|
|
28024
28031
|
var import_node_process19 = __toESM(require("node:process"));
|
|
28025
28032
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
28026
28033
|
var adjectives = [
|
|
@@ -28117,23 +28124,23 @@ ${summary}
|
|
|
28117
28124
|
return content;
|
|
28118
28125
|
}
|
|
28119
28126
|
function writeChangeset(releases, summary, cwd = import_node_process19.default.cwd()) {
|
|
28120
|
-
const changesetsDir =
|
|
28127
|
+
const changesetsDir = import_node_path18.default.join(cwd, ".pubm", "changesets");
|
|
28121
28128
|
import_node_fs10.mkdirSync(changesetsDir, { recursive: true });
|
|
28122
28129
|
const id = generateChangesetId();
|
|
28123
28130
|
const fileName = `${id}.md`;
|
|
28124
|
-
const filePath =
|
|
28131
|
+
const filePath = import_node_path18.default.join(changesetsDir, fileName);
|
|
28125
28132
|
const content = generateChangesetContent(releases, summary);
|
|
28126
28133
|
import_node_fs10.writeFileSync(filePath, content, "utf-8");
|
|
28127
28134
|
return filePath;
|
|
28128
28135
|
}
|
|
28129
28136
|
// src/monorepo/discover.ts
|
|
28130
28137
|
var import_node_fs12 = require("node:fs");
|
|
28131
|
-
var
|
|
28138
|
+
var import_node_path21 = __toESM(require("node:path"));
|
|
28132
28139
|
var import_micromatch2 = __toESM(require_micromatch(), 1);
|
|
28133
28140
|
|
|
28134
28141
|
// src/ecosystem/infer.ts
|
|
28135
28142
|
var import_promises7 = require("node:fs/promises");
|
|
28136
|
-
var
|
|
28143
|
+
var import_node_path19 = require("node:path");
|
|
28137
28144
|
var NPM_OFFICIAL = "registry.npmjs.org";
|
|
28138
28145
|
async function fileExists(path12) {
|
|
28139
28146
|
try {
|
|
@@ -28191,27 +28198,27 @@ function registryUrlToKey(url, ecosystemKey) {
|
|
|
28191
28198
|
}
|
|
28192
28199
|
async function inferJsRegistries(packagePath, rootPath) {
|
|
28193
28200
|
const registries = [];
|
|
28194
|
-
const hasPackageJson = await fileExists(
|
|
28195
|
-
const hasJsrJson = await fileExists(
|
|
28201
|
+
const hasPackageJson = await fileExists(import_node_path19.join(packagePath, "package.json"));
|
|
28202
|
+
const hasJsrJson = await fileExists(import_node_path19.join(packagePath, "jsr.json"));
|
|
28196
28203
|
if (!hasPackageJson && hasJsrJson) {
|
|
28197
28204
|
return ["jsr"];
|
|
28198
28205
|
}
|
|
28199
28206
|
if (!hasPackageJson) {
|
|
28200
28207
|
return [];
|
|
28201
28208
|
}
|
|
28202
|
-
const packageJson = await readJsonSafe(
|
|
28209
|
+
const packageJson = await readJsonSafe(import_node_path19.join(packagePath, "package.json"));
|
|
28203
28210
|
const packageName = packageJson?.name;
|
|
28204
28211
|
const publishConfigRegistry = packageJson?.publishConfig?.registry;
|
|
28205
28212
|
let npmRegistryUrl = null;
|
|
28206
28213
|
if (publishConfigRegistry) {
|
|
28207
28214
|
npmRegistryUrl = publishConfigRegistry;
|
|
28208
28215
|
} else {
|
|
28209
|
-
const npmrcContent = await readFileSafe(
|
|
28216
|
+
const npmrcContent = await readFileSafe(import_node_path19.join(packagePath, ".npmrc"));
|
|
28210
28217
|
if (npmrcContent) {
|
|
28211
28218
|
npmRegistryUrl = parseNpmrcRegistry(npmrcContent, packageName);
|
|
28212
28219
|
}
|
|
28213
28220
|
if (!npmRegistryUrl && rootPath && rootPath !== packagePath) {
|
|
28214
|
-
const rootNpmrc = await readFileSafe(
|
|
28221
|
+
const rootNpmrc = await readFileSafe(import_node_path19.join(rootPath, ".npmrc"));
|
|
28215
28222
|
if (rootNpmrc) {
|
|
28216
28223
|
npmRegistryUrl = parseNpmrcRegistry(rootNpmrc, packageName);
|
|
28217
28224
|
}
|
|
@@ -28243,7 +28250,7 @@ async function inferRegistries(packagePath, ecosystemKey, rootPath) {
|
|
|
28243
28250
|
|
|
28244
28251
|
// src/monorepo/workspace.ts
|
|
28245
28252
|
var import_node_fs11 = require("node:fs");
|
|
28246
|
-
var
|
|
28253
|
+
var import_node_path20 = require("node:path");
|
|
28247
28254
|
|
|
28248
28255
|
// ../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
28249
28256
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -29054,14 +29061,14 @@ var import_yaml3 = __toESM(require_dist(), 1);
|
|
|
29054
29061
|
function detectWorkspace(cwd) {
|
|
29055
29062
|
const root = cwd ?? process.cwd();
|
|
29056
29063
|
const workspaces = [];
|
|
29057
|
-
const pnpmWorkspacePath =
|
|
29064
|
+
const pnpmWorkspacePath = import_node_path20.join(root, "pnpm-workspace.yaml");
|
|
29058
29065
|
if (import_node_fs11.existsSync(pnpmWorkspacePath)) {
|
|
29059
29066
|
const content = import_node_fs11.readFileSync(pnpmWorkspacePath, "utf-8");
|
|
29060
29067
|
const parsed = import_yaml3.parse(content);
|
|
29061
29068
|
const packages = parsed?.packages ?? [];
|
|
29062
29069
|
workspaces.push({ type: "pnpm", patterns: packages });
|
|
29063
29070
|
}
|
|
29064
|
-
const cargoTomlPath =
|
|
29071
|
+
const cargoTomlPath = import_node_path20.join(root, "Cargo.toml");
|
|
29065
29072
|
if (import_node_fs11.existsSync(cargoTomlPath)) {
|
|
29066
29073
|
const content = import_node_fs11.readFileSync(cargoTomlPath, "utf-8");
|
|
29067
29074
|
try {
|
|
@@ -29077,7 +29084,7 @@ function detectWorkspace(cwd) {
|
|
|
29077
29084
|
} catch {}
|
|
29078
29085
|
}
|
|
29079
29086
|
for (const denoFile of ["deno.json", "deno.jsonc"]) {
|
|
29080
|
-
const denoPath =
|
|
29087
|
+
const denoPath = import_node_path20.join(root, denoFile);
|
|
29081
29088
|
if (import_node_fs11.existsSync(denoPath)) {
|
|
29082
29089
|
const content = import_node_fs11.readFileSync(denoPath, "utf-8");
|
|
29083
29090
|
try {
|
|
@@ -29091,12 +29098,12 @@ function detectWorkspace(cwd) {
|
|
|
29091
29098
|
}
|
|
29092
29099
|
}
|
|
29093
29100
|
if (!workspaces.some((w2) => w2.type === "pnpm")) {
|
|
29094
|
-
const packageJsonPath =
|
|
29101
|
+
const packageJsonPath = import_node_path20.join(root, "package.json");
|
|
29095
29102
|
if (import_node_fs11.existsSync(packageJsonPath)) {
|
|
29096
29103
|
const content = import_node_fs11.readFileSync(packageJsonPath, "utf-8");
|
|
29097
29104
|
const pkg = JSON.parse(content);
|
|
29098
29105
|
if (pkg.workspaces) {
|
|
29099
|
-
const bunfigPath =
|
|
29106
|
+
const bunfigPath = import_node_path20.join(root, "bunfig.toml");
|
|
29100
29107
|
const isBun2 = import_node_fs11.existsSync(bunfigPath);
|
|
29101
29108
|
if (Array.isArray(pkg.workspaces)) {
|
|
29102
29109
|
workspaces.push({
|
|
@@ -29132,7 +29139,7 @@ function matchesIgnore(pkgPath, ignorePatterns) {
|
|
|
29132
29139
|
function resolvePatterns(cwd, patterns) {
|
|
29133
29140
|
const entries = import_node_fs12.readdirSync(cwd, { recursive: true, encoding: "utf-8" });
|
|
29134
29141
|
const dirs = entries.filter((entry) => {
|
|
29135
|
-
const fullPath =
|
|
29142
|
+
const fullPath = import_node_path21.default.join(cwd, entry);
|
|
29136
29143
|
try {
|
|
29137
29144
|
return import_node_fs12.statSync(fullPath).isDirectory();
|
|
29138
29145
|
} catch {
|
|
@@ -29141,7 +29148,7 @@ function resolvePatterns(cwd, patterns) {
|
|
|
29141
29148
|
});
|
|
29142
29149
|
const normalizedDirs = dirs.map((d3) => d3.replace(/\\/g, "/"));
|
|
29143
29150
|
const matched = import_micromatch2.default(normalizedDirs, patterns);
|
|
29144
|
-
return matched.map((d3) =>
|
|
29151
|
+
return matched.map((d3) => import_node_path21.default.resolve(cwd, d3));
|
|
29145
29152
|
}
|
|
29146
29153
|
async function discoverFromWorkspace(cwd, ignore) {
|
|
29147
29154
|
const workspaces = detectWorkspace(cwd);
|
|
@@ -29151,9 +29158,9 @@ async function discoverFromWorkspace(cwd, ignore) {
|
|
|
29151
29158
|
if (workspace.patterns.length === 0)
|
|
29152
29159
|
continue;
|
|
29153
29160
|
const dirs = resolvePatterns(cwd, workspace.patterns);
|
|
29154
|
-
const excludedDirs = workspace.exclude?.length ? new Set(resolvePatterns(cwd, workspace.exclude).map((d3) => toForwardSlash(
|
|
29161
|
+
const excludedDirs = workspace.exclude?.length ? new Set(resolvePatterns(cwd, workspace.exclude).map((d3) => toForwardSlash(import_node_path21.default.relative(cwd, d3)))) : new Set;
|
|
29155
29162
|
for (const dir of dirs) {
|
|
29156
|
-
const relativePath =
|
|
29163
|
+
const relativePath = import_node_path21.default.relative(cwd, dir);
|
|
29157
29164
|
const normalizedRelative = toForwardSlash(relativePath);
|
|
29158
29165
|
if (excludedDirs.has(normalizedRelative))
|
|
29159
29166
|
continue;
|
|
@@ -29168,7 +29175,7 @@ async function discoverFromWorkspace(cwd, ignore) {
|
|
|
29168
29175
|
return targets;
|
|
29169
29176
|
}
|
|
29170
29177
|
async function resolvePackage(cwd, target) {
|
|
29171
|
-
const absPath =
|
|
29178
|
+
const absPath = import_node_path21.default.resolve(cwd, target.path);
|
|
29172
29179
|
let descriptor;
|
|
29173
29180
|
if (target.ecosystem) {
|
|
29174
29181
|
descriptor = ecosystemCatalog.get(target.ecosystem);
|
|
@@ -29208,13 +29215,13 @@ async function discoverPackages(options) {
|
|
|
29208
29215
|
if (isGlobPattern(pkg.path)) {
|
|
29209
29216
|
const resolved = resolvePatterns(cwd, [pkg.path]);
|
|
29210
29217
|
return resolved.map((absPath) => ({
|
|
29211
|
-
path:
|
|
29218
|
+
path: import_node_path21.default.relative(cwd, absPath),
|
|
29212
29219
|
ecosystem: pkg.ecosystem,
|
|
29213
29220
|
registries: pkg.registries
|
|
29214
29221
|
}));
|
|
29215
29222
|
}
|
|
29216
29223
|
return {
|
|
29217
|
-
path:
|
|
29224
|
+
path: import_node_path21.default.normalize(pkg.path),
|
|
29218
29225
|
ecosystem: pkg.ecosystem,
|
|
29219
29226
|
registries: pkg.registries
|
|
29220
29227
|
};
|
|
@@ -29319,7 +29326,7 @@ var import_node_child_process = require("node:child_process");
|
|
|
29319
29326
|
var import_promises8 = require("node:fs/promises");
|
|
29320
29327
|
var import_node_module3 = require("node:module");
|
|
29321
29328
|
var import_node_os5 = require("node:os");
|
|
29322
|
-
var
|
|
29329
|
+
var import_node_path22 = __toESM(require("node:path"));
|
|
29323
29330
|
var import_node_url = require("node:url");
|
|
29324
29331
|
var import_node_vm = __toESM(require("node:vm"));
|
|
29325
29332
|
var CONFIG_FILES = [
|
|
@@ -29372,7 +29379,7 @@ var CONFIG_MODULE_SHIMS = {
|
|
|
29372
29379
|
};
|
|
29373
29380
|
async function findConfigFile(cwd) {
|
|
29374
29381
|
for (const file of CONFIG_FILES) {
|
|
29375
|
-
const filePath =
|
|
29382
|
+
const filePath = import_node_path22.default.join(cwd, file);
|
|
29376
29383
|
try {
|
|
29377
29384
|
if ((await import_promises8.stat(filePath)).isFile()) {
|
|
29378
29385
|
return filePath;
|
|
@@ -29393,15 +29400,15 @@ function isBareSpecifier(specifier) {
|
|
|
29393
29400
|
return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("file:") && !specifier.startsWith("node:");
|
|
29394
29401
|
}
|
|
29395
29402
|
async function findClosestPackageManifest(filePath) {
|
|
29396
|
-
let current =
|
|
29403
|
+
let current = import_node_path22.default.dirname(filePath);
|
|
29397
29404
|
while (true) {
|
|
29398
|
-
const manifestPath =
|
|
29405
|
+
const manifestPath = import_node_path22.default.join(current, "package.json");
|
|
29399
29406
|
try {
|
|
29400
29407
|
if ((await import_promises8.stat(manifestPath)).isFile()) {
|
|
29401
29408
|
return manifestPath;
|
|
29402
29409
|
}
|
|
29403
29410
|
} catch {}
|
|
29404
|
-
const parent =
|
|
29411
|
+
const parent = import_node_path22.default.dirname(current);
|
|
29405
29412
|
if (parent === current) {
|
|
29406
29413
|
return null;
|
|
29407
29414
|
}
|
|
@@ -29503,13 +29510,13 @@ async function collectOptionalDependenciesForInputs(inputPaths) {
|
|
|
29503
29510
|
async function findInstalledPackagePath(startDir, dependency) {
|
|
29504
29511
|
let current = startDir;
|
|
29505
29512
|
while (true) {
|
|
29506
|
-
const packageDir =
|
|
29513
|
+
const packageDir = import_node_path22.default.join(current, "node_modules", dependency);
|
|
29507
29514
|
try {
|
|
29508
29515
|
if ((await import_promises8.stat(packageDir)).isDirectory()) {
|
|
29509
29516
|
return packageDir;
|
|
29510
29517
|
}
|
|
29511
29518
|
} catch {}
|
|
29512
|
-
const parent =
|
|
29519
|
+
const parent = import_node_path22.default.dirname(current);
|
|
29513
29520
|
if (parent === current) {
|
|
29514
29521
|
return null;
|
|
29515
29522
|
}
|
|
@@ -29517,19 +29524,19 @@ async function findInstalledPackagePath(startDir, dependency) {
|
|
|
29517
29524
|
}
|
|
29518
29525
|
}
|
|
29519
29526
|
async function writeOptionalDependencyStubs(moduleDir, resolveFromDir, optionalDependencies) {
|
|
29520
|
-
const nodeModulesDir =
|
|
29527
|
+
const nodeModulesDir = import_node_path22.default.join(moduleDir, "node_modules");
|
|
29521
29528
|
for (const dependency of optionalDependencies) {
|
|
29522
29529
|
if (await findInstalledPackagePath(resolveFromDir, dependency)) {
|
|
29523
29530
|
continue;
|
|
29524
29531
|
}
|
|
29525
|
-
const packageDir =
|
|
29532
|
+
const packageDir = import_node_path22.default.join(nodeModulesDir, dependency);
|
|
29526
29533
|
await import_promises8.mkdir(packageDir, { recursive: true });
|
|
29527
|
-
await import_promises8.writeFile(
|
|
29534
|
+
await import_promises8.writeFile(import_node_path22.default.join(packageDir, "package.json"), JSON.stringify({
|
|
29528
29535
|
name: dependency,
|
|
29529
29536
|
private: true,
|
|
29530
29537
|
main: "./index.js"
|
|
29531
29538
|
}, null, 2), "utf8");
|
|
29532
|
-
await import_promises8.writeFile(
|
|
29539
|
+
await import_promises8.writeFile(import_node_path22.default.join(packageDir, "index.js"), createOptionalDependencyProxyPackage(dependency), "utf8");
|
|
29533
29540
|
}
|
|
29534
29541
|
}
|
|
29535
29542
|
function createOptionalDependencyPlugin(specifiers) {
|
|
@@ -29641,10 +29648,10 @@ async function buildConfigWithFormat(entrypoint, format3) {
|
|
|
29641
29648
|
}
|
|
29642
29649
|
async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
|
|
29643
29650
|
const extension = format3 === "esm" ? "mjs" : "cjs";
|
|
29644
|
-
const tempDir = await import_promises8.mkdtemp(
|
|
29645
|
-
const buildScript =
|
|
29646
|
-
const outfile =
|
|
29647
|
-
const resultFile =
|
|
29651
|
+
const tempDir = await import_promises8.mkdtemp(import_node_path22.default.join(import_node_os5.tmpdir(), "pubm-config-"));
|
|
29652
|
+
const buildScript = import_node_path22.default.join(tempDir, "build-config.mjs");
|
|
29653
|
+
const outfile = import_node_path22.default.join(tempDir, `pubm.config.${extension}`);
|
|
29654
|
+
const resultFile = import_node_path22.default.join(tempDir, "build-result.json");
|
|
29648
29655
|
try {
|
|
29649
29656
|
await import_promises8.writeFile(buildScript, [
|
|
29650
29657
|
'import { readFile, stat, writeFile } from "node:fs/promises";',
|
|
@@ -29920,11 +29927,11 @@ async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
|
|
|
29920
29927
|
}
|
|
29921
29928
|
function rewriteImportMeta(source, configPath) {
|
|
29922
29929
|
const replacements = [
|
|
29923
|
-
["import.meta.dirname", JSON.stringify(
|
|
29930
|
+
["import.meta.dirname", JSON.stringify(import_node_path22.default.dirname(configPath))],
|
|
29924
29931
|
["import.meta.filename", JSON.stringify(configPath)],
|
|
29925
29932
|
["import.meta.path", JSON.stringify(configPath)],
|
|
29926
29933
|
["import.meta.url", JSON.stringify(import_node_url.pathToFileURL(configPath).href)],
|
|
29927
|
-
["import.meta.dir", JSON.stringify(
|
|
29934
|
+
["import.meta.dir", JSON.stringify(import_node_path22.default.dirname(configPath))]
|
|
29928
29935
|
];
|
|
29929
29936
|
let rewritten = source;
|
|
29930
29937
|
for (const [pattern, value] of replacements) {
|
|
@@ -29940,10 +29947,10 @@ async function importConfigModule(configPath) {
|
|
|
29940
29947
|
return normalizeConfigNamespace(namespace);
|
|
29941
29948
|
}
|
|
29942
29949
|
async function importBundledConfig(source, configPath, optionalDependencies) {
|
|
29943
|
-
const tempDir = await import_promises8.mkdtemp(
|
|
29944
|
-
const tempFile =
|
|
29950
|
+
const tempDir = await import_promises8.mkdtemp(import_node_path22.default.join(import_node_path22.default.dirname(configPath), ".pubm-config-module-"));
|
|
29951
|
+
const tempFile = import_node_path22.default.join(tempDir, "pubm.config.mjs");
|
|
29945
29952
|
try {
|
|
29946
|
-
await writeOptionalDependencyStubs(tempDir,
|
|
29953
|
+
await writeOptionalDependencyStubs(tempDir, import_node_path22.default.dirname(configPath), optionalDependencies);
|
|
29947
29954
|
await import_promises8.writeFile(tempFile, source, "utf8");
|
|
29948
29955
|
return importConfigModule(tempFile);
|
|
29949
29956
|
} finally {
|
|
@@ -29958,7 +29965,7 @@ async function executeBundledConfigInVm(source, configPath) {
|
|
|
29958
29965
|
exports: module2.exports,
|
|
29959
29966
|
require: require3,
|
|
29960
29967
|
__filename: configPath,
|
|
29961
|
-
__dirname:
|
|
29968
|
+
__dirname: import_node_path22.default.dirname(configPath),
|
|
29962
29969
|
console,
|
|
29963
29970
|
process,
|
|
29964
29971
|
Buffer,
|
|
@@ -31191,8 +31198,8 @@ async function findBinaryInDir(dir) {
|
|
|
31191
31198
|
]);
|
|
31192
31199
|
const binaryCandidates = files.filter((file) => {
|
|
31193
31200
|
const ext = import_path.default.extname(file).toLowerCase();
|
|
31194
|
-
const
|
|
31195
|
-
return !NON_BINARY_EXTENSIONS.has(ext) &&
|
|
31201
|
+
const basename4 = import_path.default.basename(file).toLowerCase();
|
|
31202
|
+
return !NON_BINARY_EXTENSIONS.has(ext) && basename4 !== "license" && basename4 !== "readme";
|
|
31196
31203
|
});
|
|
31197
31204
|
return binaryCandidates.length > 0 ? binaryCandidates[0] : files[0];
|
|
31198
31205
|
}
|
|
@@ -32668,10 +32675,10 @@ init_ui();
|
|
|
32668
32675
|
|
|
32669
32676
|
// src/validate/entry-points.ts
|
|
32670
32677
|
var import_node_fs13 = require("node:fs");
|
|
32671
|
-
var
|
|
32678
|
+
var import_node_path23 = __toESM(require("node:path"));
|
|
32672
32679
|
var SIMPLE_FIELDS = ["main", "module", "types", "typings"];
|
|
32673
32680
|
function checkPath(filePath, cwd) {
|
|
32674
|
-
return import_node_fs13.existsSync(
|
|
32681
|
+
return import_node_fs13.existsSync(import_node_path23.default.resolve(cwd, filePath));
|
|
32675
32682
|
}
|
|
32676
32683
|
function validateExports(exports2, cwd, prefix = "exports") {
|
|
32677
32684
|
const errors = [];
|
|
@@ -32757,8 +32764,8 @@ var PATTERNS = [
|
|
|
32757
32764
|
function detectExtraneousFiles(files) {
|
|
32758
32765
|
const result = [];
|
|
32759
32766
|
const seen = new Set;
|
|
32760
|
-
for (const { pattern, reason, basename:
|
|
32761
|
-
const options =
|
|
32767
|
+
for (const { pattern, reason, basename: basename4 } of PATTERNS) {
|
|
32768
|
+
const options = basename4 ? { basename: true } : {};
|
|
32762
32769
|
const matched = import_micromatch4.default(files, pattern, options);
|
|
32763
32770
|
for (const file of matched) {
|
|
32764
32771
|
if (!seen.has(file)) {
|
package/dist/index.js
CHANGED
|
@@ -22206,6 +22206,9 @@ function I() {
|
|
|
22206
22206
|
var L = I();
|
|
22207
22207
|
var R = L?.name || ``;
|
|
22208
22208
|
|
|
22209
|
+
// src/assets/pipeline.ts
|
|
22210
|
+
import { basename as basename3, extname as extname3 } from "node:path";
|
|
22211
|
+
|
|
22209
22212
|
// src/assets/compressor.ts
|
|
22210
22213
|
init_exec();
|
|
22211
22214
|
import { unlinkSync } from "node:fs";
|
|
@@ -22252,10 +22255,11 @@ function resolveCompressFormat(filePath, os, option) {
|
|
|
22252
22255
|
return "zip";
|
|
22253
22256
|
return "tar.gz";
|
|
22254
22257
|
}
|
|
22255
|
-
async function compressFile(filePath, outDir, format2, extraFiles) {
|
|
22258
|
+
async function compressFile(filePath, outDir, format2, extraFiles, archiveBaseName) {
|
|
22256
22259
|
const file = basename(filePath);
|
|
22257
22260
|
const dir = join(filePath, "..");
|
|
22258
|
-
const
|
|
22261
|
+
const stem = archiveBaseName ?? basename(filePath, extname(filePath));
|
|
22262
|
+
const archiveName = `${stem}.${format2}`;
|
|
22259
22263
|
const archivePath = join(outDir, archiveName);
|
|
22260
22264
|
const allFiles = [file, ...extraFiles?.map((f2) => basename(f2)) ?? []];
|
|
22261
22265
|
switch (format2) {
|
|
@@ -22399,7 +22403,10 @@ async function defaultCompress(asset, tempDir) {
|
|
|
22399
22403
|
config
|
|
22400
22404
|
};
|
|
22401
22405
|
}
|
|
22402
|
-
const
|
|
22406
|
+
const stem = basename3(filePath, extname3(filePath));
|
|
22407
|
+
const platformSuffix = platform2.raw ? `-${platform2.raw}` : "";
|
|
22408
|
+
const archiveBaseName = `${stem}${platformSuffix}`;
|
|
22409
|
+
const archivePath = await compressFile(filePath, tempDir, config.compress, asset.extraFiles, archiveBaseName);
|
|
22403
22410
|
return {
|
|
22404
22411
|
filePath: archivePath,
|
|
22405
22412
|
originalPath: filePath,
|
|
@@ -22941,7 +22948,7 @@ function isValidPackageName(packageName) {
|
|
|
22941
22948
|
// package.json
|
|
22942
22949
|
var package_default = {
|
|
22943
22950
|
name: "@pubm/core",
|
|
22944
|
-
version: "0.4.
|
|
22951
|
+
version: "0.4.2",
|
|
22945
22952
|
type: "module",
|
|
22946
22953
|
description: "Core SDK for pubm - publish manager for multiple registries",
|
|
22947
22954
|
types: "./dist/index.d.ts",
|
|
@@ -23001,7 +23008,7 @@ var coreEngines = package_default.engines ?? {};
|
|
|
23001
23008
|
function resolveDefine(injected, fallback) {
|
|
23002
23009
|
return typeof injected === "string" ? injected : fallback;
|
|
23003
23010
|
}
|
|
23004
|
-
var PUBM_VERSION = resolveDefine("0.4.
|
|
23011
|
+
var PUBM_VERSION = resolveDefine("0.4.2", package_default.version);
|
|
23005
23012
|
var PUBM_ENGINES = {
|
|
23006
23013
|
node: resolveDefine(">=24", coreEngines.node ?? ">=18"),
|
|
23007
23014
|
git: resolveDefine(">=2.11.0", coreEngines.git ?? ">=2.11.0"),
|
|
@@ -31103,8 +31110,8 @@ async function findBinaryInDir(dir) {
|
|
|
31103
31110
|
]);
|
|
31104
31111
|
const binaryCandidates = files.filter((file) => {
|
|
31105
31112
|
const ext = path14.extname(file).toLowerCase();
|
|
31106
|
-
const
|
|
31107
|
-
return !NON_BINARY_EXTENSIONS.has(ext) &&
|
|
31113
|
+
const basename4 = path14.basename(file).toLowerCase();
|
|
31114
|
+
return !NON_BINARY_EXTENSIONS.has(ext) && basename4 !== "license" && basename4 !== "readme";
|
|
31108
31115
|
});
|
|
31109
31116
|
return binaryCandidates.length > 0 ? binaryCandidates[0] : files[0];
|
|
31110
31117
|
}
|
|
@@ -32669,8 +32676,8 @@ var PATTERNS = [
|
|
|
32669
32676
|
function detectExtraneousFiles(files) {
|
|
32670
32677
|
const result = [];
|
|
32671
32678
|
const seen = new Set;
|
|
32672
|
-
for (const { pattern, reason, basename:
|
|
32673
|
-
const options =
|
|
32679
|
+
for (const { pattern, reason, basename: basename4 } of PATTERNS) {
|
|
32680
|
+
const options = basename4 ? { basename: true } : {};
|
|
32674
32681
|
const matched = import_micromatch4.default(files, pattern, options);
|
|
32675
32682
|
for (const file of matched) {
|
|
32676
32683
|
if (!seen.has(file)) {
|