vlt 0.0.0-3 → 0.0.0-4
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/README.md +2 -1
- package/package.json +17 -10
- package/postinstall.cjs +56 -0
- package/vlix +25 -0
- package/vlr +25 -0
- package/vlrx +25 -0
- package/vlt +25 -0
- package/vlx +25 -0
- package/cache-unzip-src-unzip.js +0 -7896
- package/cache-unzip-src-unzip.js.map +0 -7
- package/chunk-227OF2U2.js +0 -1183
- package/chunk-227OF2U2.js.map +0 -7
- package/chunk-3HXIYJS2.js +0 -54
- package/chunk-3HXIYJS2.js.map +0 -7
- package/chunk-AA6MVXJX.js +0 -19823
- package/chunk-AA6MVXJX.js.map +0 -7
- package/chunk-BCK4ZGNG.js +0 -41
- package/chunk-BCK4ZGNG.js.map +0 -7
- package/chunk-DH36SF3E.js +0 -35
- package/chunk-DH36SF3E.js.map +0 -7
- package/chunk-FNKWJ7AZ.js +0 -1379
- package/chunk-FNKWJ7AZ.js.map +0 -7
- package/chunk-H77UDCL3.js +0 -9820
- package/chunk-H77UDCL3.js.map +0 -7
- package/chunk-HL76E44L.js +0 -73
- package/chunk-HL76E44L.js.map +0 -7
- package/chunk-IN7DEH7F.js +0 -44
- package/chunk-IN7DEH7F.js.map +0 -7
- package/chunk-JLP2QDXQ.js +0 -1137
- package/chunk-JLP2QDXQ.js.map +0 -7
- package/chunk-JMGSFQ32.js +0 -969
- package/chunk-JMGSFQ32.js.map +0 -7
- package/chunk-JQRUGUZ3.js +0 -512
- package/chunk-JQRUGUZ3.js.map +0 -7
- package/chunk-K2BYYPM7.js +0 -8656
- package/chunk-K2BYYPM7.js.map +0 -7
- package/chunk-LNUDEBGP.js +0 -2071
- package/chunk-LNUDEBGP.js.map +0 -7
- package/chunk-MV5ZQ3LW.js +0 -1105
- package/chunk-MV5ZQ3LW.js.map +0 -7
- package/chunk-O7CDQZDW.js +0 -5234
- package/chunk-O7CDQZDW.js.map +0 -7
- package/chunk-OFW7MWFP.js +0 -82
- package/chunk-OFW7MWFP.js.map +0 -7
- package/chunk-PGDJ2ZZ6.js +0 -4810
- package/chunk-PGDJ2ZZ6.js.map +0 -7
- package/chunk-POVPHE2F.js +0 -1864
- package/chunk-POVPHE2F.js.map +0 -7
- package/chunk-PTVPYZHU.js +0 -72
- package/chunk-PTVPYZHU.js.map +0 -7
- package/chunk-SXBMMXTY.js +0 -11837
- package/chunk-SXBMMXTY.js.map +0 -7
- package/chunk-UZZ72UON.js +0 -152
- package/chunk-UZZ72UON.js.map +0 -7
- package/chunk-V7KRP7IO.js +0 -481
- package/chunk-V7KRP7IO.js.map +0 -7
- package/chunk-WVNUD273.js +0 -83
- package/chunk-WVNUD273.js.map +0 -7
- package/chunk-WYPE3MV4.js +0 -62
- package/chunk-WYPE3MV4.js.map +0 -7
- package/chunk-ZRNJWPYC.js +0 -37
- package/chunk-ZRNJWPYC.js.map +0 -7
- package/cli-package.json +0 -107
- package/config-3QQHUYLI.js +0 -179
- package/config-3QQHUYLI.js.map +0 -7
- package/devtools-5BBQJTDW.js +0 -16682
- package/devtools-5BBQJTDW.js.map +0 -7
- package/exec-C6GK336U.js +0 -50
- package/exec-C6GK336U.js.map +0 -7
- package/gui-IQ4M4K5X.js +0 -46
- package/gui-IQ4M4K5X.js.map +0 -7
- package/gui-assets/favicon.ico +0 -0
- package/gui-assets/fonts/geist-mono.ttf +0 -0
- package/gui-assets/fonts/inter.ttf +0 -0
- package/gui-assets/images/folder.png +0 -0
- package/gui-assets/index.html +0 -34
- package/gui-assets/index.js +0 -1549
- package/gui-assets/index.js.map +0 -7
- package/gui-assets/main.css +0 -1
- package/help-R6TSKVEA.js +0 -25
- package/help-R6TSKVEA.js.map +0 -7
- package/init-UTJGYULC.js +0 -25
- package/init-UTJGYULC.js.map +0 -7
- package/install-5XDTGLAU.js +0 -56
- package/install-5XDTGLAU.js.map +0 -7
- package/install-exec-VMPN3JE7.js +0 -28
- package/install-exec-VMPN3JE7.js.map +0 -7
- package/list-Q7IANZ3I.js +0 -129
- package/list-Q7IANZ3I.js.map +0 -7
- package/login-VHJEIRVU.js +0 -36
- package/login-VHJEIRVU.js.map +0 -7
- package/logout-5KMCSSR4.js +0 -36
- package/logout-5KMCSSR4.js.map +0 -7
- package/pkg-WYFDWETL.js +0 -364
- package/pkg-WYFDWETL.js.map +0 -7
- package/query-KP4F5D2Y.js +0 -117
- package/query-KP4F5D2Y.js.map +0 -7
- package/registry-client-package.json +0 -85
- package/reporter-LFGXWL6N.js +0 -18
- package/reporter-LFGXWL6N.js.map +0 -7
- package/rollback-remove-src-remove.js +0 -7398
- package/rollback-remove-src-remove.js.map +0 -7
- package/run-XNDZH72D.js +0 -68
- package/run-XNDZH72D.js.map +0 -7
- package/run-exec-NXA33NXJ.js +0 -41
- package/run-exec-NXA33NXJ.js.map +0 -7
- package/source-JWPG6PR3.js +0 -33
- package/source-JWPG6PR3.js.map +0 -7
- package/token-6IJNGEMI.js +0 -86
- package/token-6IJNGEMI.js.map +0 -7
- package/uninstall-MI7NFD27.js +0 -45
- package/uninstall-MI7NFD27.js.map +0 -7
- package/vlix.js +0 -25
- package/vlix.js.map +0 -7
- package/vlr.js +0 -25
- package/vlr.js.map +0 -7
- package/vlrx.js +0 -25
- package/vlrx.js.map +0 -7
- package/vlt.js +0 -24
- package/vlt.js.map +0 -7
- package/vlx.js +0 -25
- package/vlx.js.map +0 -7
- package/whoami-3IEXJF3U.js +0 -46
- package/whoami-3IEXJF3U.js.map +0 -7
- package/yoga.wasm +0 -0
package/chunk-HL76E44L.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
var global = globalThis;
|
|
2
|
-
import {Buffer} from "node:buffer";
|
|
3
|
-
import {setImmediate, clearImmediate} from "node:timers";
|
|
4
|
-
import {createRequire as _vlt_createRequire} from 'node:module';
|
|
5
|
-
var require = _vlt_createRequire(import.meta.filename);
|
|
6
|
-
import {
|
|
7
|
-
asDependency
|
|
8
|
-
} from "./chunk-K2BYYPM7.js";
|
|
9
|
-
import {
|
|
10
|
-
joinDepIDTuple
|
|
11
|
-
} from "./chunk-JMGSFQ32.js";
|
|
12
|
-
import {
|
|
13
|
-
Spec2 as Spec
|
|
14
|
-
} from "./chunk-POVPHE2F.js";
|
|
15
|
-
|
|
16
|
-
// ../../src/vlt/src/parse-add-remove-args.ts
|
|
17
|
-
var rootDepID = joinDepIDTuple(["file", "."]);
|
|
18
|
-
var getImporters = (opts, monorepo) => {
|
|
19
|
-
const res = /* @__PURE__ */ new Set();
|
|
20
|
-
if (monorepo) {
|
|
21
|
-
for (const ws of monorepo.filter(opts)) {
|
|
22
|
-
res.add(ws.id);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (!res.size) {
|
|
26
|
-
res.add(rootDepID);
|
|
27
|
-
}
|
|
28
|
-
return res;
|
|
29
|
-
};
|
|
30
|
-
var getType = (opts) => opts["save-prod"] ? "prod" : opts["save-dev"] ? "dev" : opts["save-peer"] ? opts["save-optional"] ? "peerOptional" : "peer" : opts["save-optional"] ? "optional" : "prod";
|
|
31
|
-
var AddImportersDependenciesMapImpl = class extends Map {
|
|
32
|
-
modifiedDependencies = false;
|
|
33
|
-
};
|
|
34
|
-
var RemoveImportersDependenciesMapImpl = class extends Map {
|
|
35
|
-
modifiedDependencies = false;
|
|
36
|
-
};
|
|
37
|
-
var parseAddArgs = (config, monorepo) => {
|
|
38
|
-
const add = new AddImportersDependenciesMapImpl();
|
|
39
|
-
const items = config.positionals;
|
|
40
|
-
const type = getType(config.values);
|
|
41
|
-
const importers = getImporters(config.values, monorepo);
|
|
42
|
-
const newDependencies = /* @__PURE__ */ new Map();
|
|
43
|
-
const specOptions = config.options;
|
|
44
|
-
const getName = (s) => s.name === "(unknown)" ? s.spec : s.name;
|
|
45
|
-
for (const item of items) {
|
|
46
|
-
const spec = Spec.parseArgs(item, specOptions);
|
|
47
|
-
newDependencies.set(getName(spec), asDependency({ spec, type }));
|
|
48
|
-
add.modifiedDependencies = true;
|
|
49
|
-
}
|
|
50
|
-
for (const importer of importers) {
|
|
51
|
-
add.set(importer, newDependencies);
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
add
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
var parseRemoveArgs = (config, monorepo) => {
|
|
58
|
-
const remove = new RemoveImportersDependenciesMapImpl();
|
|
59
|
-
const importers = getImporters(config.values, monorepo);
|
|
60
|
-
for (const importer of importers) {
|
|
61
|
-
remove.set(importer, new Set(config.positionals));
|
|
62
|
-
remove.modifiedDependencies = true;
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
remove
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export {
|
|
70
|
-
parseAddArgs,
|
|
71
|
-
parseRemoveArgs
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=chunk-HL76E44L.js.map
|
package/chunk-HL76E44L.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/vlt/src/parse-add-remove-args.ts"],
|
|
4
|
-
"sourcesContent": ["import { joinDepIDTuple } from '@vltpkg/dep-id'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { DependencyTypeShort } from '@vltpkg/types'\nimport { asDependency } from '@vltpkg/graph'\nimport type {\n AddImportersDependenciesMap,\n Dependency,\n RemoveImportersDependenciesMap,\n} from '@vltpkg/graph'\nimport type { LoadedConfig } from './config/index.ts'\nimport { Spec } from '@vltpkg/spec'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { Monorepo } from '@vltpkg/workspaces'\n\nexport type ParsedAddArgs = {\n add: AddImportersDependenciesMap\n}\n\nexport type ParsedRemoveArgs = {\n remove: RemoveImportersDependenciesMap\n}\n\nexport type SaveTypes = {\n 'save-dev'?: boolean\n 'save-optional'?: boolean\n 'save-peer'?: boolean\n 'save-prod'?: boolean\n}\n\nexport type WorkspaceTypes = {\n workspace?: string[]\n 'workspace-group'?: string[]\n}\n\nconst rootDepID = joinDepIDTuple(['file', '.'])\n\n/**\n * Get the list of importers that are currently selected\n * in {@link WorkspaceTypes}.\n */\nconst getImporters = (\n opts: WorkspaceTypes,\n monorepo?: Monorepo,\n): Set<DepID> => {\n const res = new Set<DepID>()\n\n // collects DepID references to any selected workspace\n if (monorepo) {\n for (const ws of monorepo.filter(opts)) {\n res.add(ws.id)\n }\n }\n\n // if no references were found, default behavior is to point to project root\n if (!res.size) {\n res.add(rootDepID)\n }\n\n return res\n}\n\nconst getType = (opts: SaveTypes): DependencyTypeShort =>\n opts['save-prod'] ? 'prod'\n : opts['save-dev'] ? 'dev'\n : opts['save-peer'] ?\n opts['save-optional'] ?\n 'peerOptional'\n : 'peer'\n : opts['save-optional'] ? 'optional'\n : 'prod'\n\nclass AddImportersDependenciesMapImpl\n extends Map\n implements AddImportersDependenciesMap\n{\n modifiedDependencies = false\n}\n\nclass RemoveImportersDependenciesMapImpl\n extends Map\n implements RemoveImportersDependenciesMap\n{\n modifiedDependencies = false\n}\n\nexport const parseAddArgs = (\n config: LoadedConfig,\n monorepo?: Monorepo,\n): ParsedAddArgs => {\n const add: AddImportersDependenciesMap =\n new AddImportersDependenciesMapImpl()\n const items = config.positionals\n const type = getType(config.values)\n const importers = getImporters(config.values, monorepo)\n const newDependencies = new Map<string, Dependency>()\n const specOptions: SpecOptions = config.options\n\n // nameless spec definitions will need to use their full\n // stringified spec result instead of their name in order\n // to have an unique key name in the resulting Map\n const getName = (s: Spec): string =>\n s.name === '(unknown)' ? s.spec : s.name\n\n for (const item of items) {\n const spec = Spec.parseArgs(item, specOptions)\n newDependencies.set(getName(spec), asDependency({ spec, type }))\n add.modifiedDependencies = true\n }\n\n for (const importer of importers) {\n add.set(importer, newDependencies)\n }\n\n return {\n add,\n }\n}\n\nexport const parseRemoveArgs = (\n config: LoadedConfig,\n monorepo?: Monorepo,\n): ParsedRemoveArgs => {\n const remove: RemoveImportersDependenciesMap =\n new RemoveImportersDependenciesMapImpl()\n const importers = getImporters(config.values, monorepo)\n\n for (const importer of importers) {\n remove.set(importer, new Set(config.positionals))\n remove.modifiedDependencies = true\n }\n\n return {\n remove,\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAkCA,IAAM,YAAY,eAAe,CAAC,QAAQ,GAAG,CAAC;AAM9C,IAAM,eAAe,CACnB,MACA,aACe;AACf,QAAM,MAAM,oBAAI,IAAW;AAG3B,MAAI,UAAU;AACZ,eAAW,MAAM,SAAS,OAAO,IAAI,GAAG;AACtC,UAAI,IAAI,GAAG,EAAE;AAAA,IACf;AAAA,EACF;AAGA,MAAI,CAAC,IAAI,MAAM;AACb,QAAI,IAAI,SAAS;AAAA,EACnB;AAEA,SAAO;AACT;AAEA,IAAM,UAAU,CAAC,SACf,KAAK,WAAW,IAAI,SAClB,KAAK,UAAU,IAAI,QACnB,KAAK,WAAW,IAChB,KAAK,eAAe,IAClB,iBACA,SACF,KAAK,eAAe,IAAI,aACxB;AAEJ,IAAM,kCAAN,cACU,IAEV;AAAA,EACE,uBAAuB;AACzB;AAEA,IAAM,qCAAN,cACU,IAEV;AAAA,EACE,uBAAuB;AACzB;AAEO,IAAM,eAAe,CAC1B,QACA,aACkB;AAClB,QAAM,MACJ,IAAI,gCAAgC;AACtC,QAAM,QAAQ,OAAO;AACrB,QAAM,OAAO,QAAQ,OAAO,MAAM;AAClC,QAAM,YAAY,aAAa,OAAO,QAAQ,QAAQ;AACtD,QAAM,kBAAkB,oBAAI,IAAwB;AACpD,QAAM,cAA2B,OAAO;AAKxC,QAAM,UAAU,CAAC,MACf,EAAE,SAAS,cAAc,EAAE,OAAO,EAAE;AAEtC,aAAW,QAAQ,OAAO;AACxB,UAAM,OAAO,KAAK,UAAU,MAAM,WAAW;AAC7C,oBAAgB,IAAI,QAAQ,IAAI,GAAG,aAAa,EAAE,MAAM,KAAK,CAAC,CAAC;AAC/D,QAAI,uBAAuB;AAAA,EAC7B;AAEA,aAAW,YAAY,WAAW;AAChC,QAAI,IAAI,UAAU,eAAe;AAAA,EACnC;AAEA,SAAO;AAAA,IACL;AAAA,EACF;AACF;AAEO,IAAM,kBAAkB,CAC7B,QACA,aACqB;AACrB,QAAM,SACJ,IAAI,mCAAmC;AACzC,QAAM,YAAY,aAAa,OAAO,QAAQ,QAAQ;AAEtD,aAAW,YAAY,WAAW;AAChC,WAAO,IAAI,UAAU,IAAI,IAAI,OAAO,WAAW,CAAC;AAChD,WAAO,uBAAuB;AAAA,EAChC;AAEA,SAAO;AAAA,IACL;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/chunk-IN7DEH7F.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
var global = globalThis;
|
|
2
|
-
import {Buffer} from "node:buffer";
|
|
3
|
-
import {setImmediate, clearImmediate} from "node:timers";
|
|
4
|
-
import {createRequire as _vlt_createRequire} from 'node:module';
|
|
5
|
-
var require = _vlt_createRequire(import.meta.filename);
|
|
6
|
-
|
|
7
|
-
// ../../node_modules/.pnpm/package-json-from-dist@1.0.1/node_modules/package-json-from-dist/dist/esm/index.js
|
|
8
|
-
import { readFileSync } from "node:fs";
|
|
9
|
-
import { dirname, resolve, sep } from "node:path";
|
|
10
|
-
import { fileURLToPath } from "node:url";
|
|
11
|
-
var NM = `${sep}node_modules${sep}`;
|
|
12
|
-
var STORE = `.store${sep}`;
|
|
13
|
-
var PKG = `${sep}package${sep}`;
|
|
14
|
-
var DIST = `${sep}dist${sep}`;
|
|
15
|
-
var findPackageJson = (from, pathFromSrc = "../package.json") => {
|
|
16
|
-
const f = typeof from === "object" || from.startsWith("file://") ? fileURLToPath(from) : from;
|
|
17
|
-
const __dirname = dirname(f);
|
|
18
|
-
const nms = __dirname.lastIndexOf(NM);
|
|
19
|
-
if (nms !== -1) {
|
|
20
|
-
const nm = __dirname.substring(0, nms + NM.length);
|
|
21
|
-
const pkgDir = __dirname.substring(nms + NM.length);
|
|
22
|
-
if (pkgDir.startsWith(STORE)) {
|
|
23
|
-
const pkg = pkgDir.indexOf(PKG, STORE.length);
|
|
24
|
-
if (pkg) {
|
|
25
|
-
return resolve(nm, pkgDir.substring(0, pkg + PKG.length), "package.json");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const pkgName = pkgDir.startsWith("@") ? pkgDir.split(sep, 2).join(sep) : String(pkgDir.split(sep)[0]);
|
|
29
|
-
return resolve(nm, pkgName, "package.json");
|
|
30
|
-
} else {
|
|
31
|
-
const d = __dirname.lastIndexOf(DIST);
|
|
32
|
-
if (d !== -1) {
|
|
33
|
-
return resolve(__dirname.substring(0, d), "package.json");
|
|
34
|
-
} else {
|
|
35
|
-
return resolve(__dirname, pathFromSrc);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
var loadPackageJson = (from, pathFromSrc = "../package.json") => JSON.parse(readFileSync(findPackageJson(from, pathFromSrc), "utf8"));
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
loadPackageJson
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=chunk-IN7DEH7F.js.map
|
package/chunk-IN7DEH7F.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../node_modules/.pnpm/package-json-from-dist@1.0.1/node_modules/package-json-from-dist/src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { readFileSync } from 'node:fs'\nimport { dirname, resolve, sep } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst NM = `${sep}node_modules${sep}`\nconst STORE = `.store${sep}`\nconst PKG = `${sep}package${sep}`\nconst DIST = `${sep}dist${sep}`\n\n/**\n * Find the package.json file, either from a TypeScript file somewhere not\n * in a 'dist' folder, or a built and/or installed 'dist' folder.\n *\n * Note: this *only* works if you build your code into `'./dist'`, and that the\n * source path does not also contain `'dist'`! If you don't build into\n * `'./dist'`, or if you have files at `./src/dist/dist.ts`, then this will\n * not work properly!\n *\n * The default `pathFromSrc` option assumes that the calling code lives one\n * folder below the root of the package. Otherwise, it must be specified.\n *\n * Example:\n *\n * ```ts\n * // src/index.ts\n * import { findPackageJson } from 'package-json-from-dist'\n *\n * const pj = findPackageJson(import.meta.url)\n * console.log(`package.json found at ${pj}`)\n * ```\n *\n * If the caller is deeper within the project source, then you must provide\n * the appropriate fallback path:\n *\n * ```ts\n * // src/components/something.ts\n * import { findPackageJson } from 'package-json-from-dist'\n *\n * const pj = findPackageJson(import.meta.url, '../../package.json')\n * console.log(`package.json found at ${pj}`)\n * ```\n *\n * When running from CommmonJS, use `__filename` instead of `import.meta.url`\n *\n * ```ts\n * // src/index.cts\n * import { findPackageJson } from 'package-json-from-dist'\n *\n * const pj = findPackageJson(__filename)\n * console.log(`package.json found at ${pj}`)\n * ```\n */\nexport const findPackageJson = (\n from: string | URL,\n pathFromSrc: string = '../package.json',\n): string => {\n const f =\n typeof from === 'object' || from.startsWith('file://') ?\n fileURLToPath(from)\n : from\n const __dirname = dirname(f)\n\n const nms = __dirname.lastIndexOf(NM)\n if (nms !== -1) {\n // inside of node_modules. find the dist directly under package name.\n const nm = __dirname.substring(0, nms + NM.length)\n const pkgDir = __dirname.substring(nms + NM.length)\n // affordance for yarn berry, which puts package contents in\n // '.../node_modules/.store/${id}-${hash}/package/...'\n if (pkgDir.startsWith(STORE)) {\n const pkg = pkgDir.indexOf(PKG, STORE.length)\n if (pkg) {\n return resolve(\n nm,\n pkgDir.substring(0, pkg + PKG.length),\n 'package.json',\n )\n }\n }\n const pkgName =\n pkgDir.startsWith('@') ?\n pkgDir.split(sep, 2).join(sep)\n : String(pkgDir.split(sep)[0])\n return resolve(nm, pkgName, 'package.json')\n } else {\n // see if we are in a dist folder.\n const d = __dirname.lastIndexOf(DIST)\n if (d !== -1) {\n return resolve(__dirname.substring(0, d), 'package.json')\n } else {\n return resolve(__dirname, pathFromSrc)\n }\n }\n}\n\n/**\n * Load the package.json file, either from a TypeScript file somewhere not\n * in a 'dist' folder, or a built and/or installed 'dist' folder.\n *\n * Note: this *only* works if you build your code into `'./dist'`, and that the\n * source path does not also contain `'dist'`! If you don't build into\n * `'./dist'`, or if you have files at `./src/dist/dist.ts`, then this will\n * not work properly!\n *\n * The default `pathFromSrc` option assumes that the calling code lives one\n * folder below the root of the package. Otherwise, it must be specified.\n *\n * Example:\n *\n * ```ts\n * // src/index.ts\n * import { loadPackageJson } from 'package-json-from-dist'\n *\n * const pj = loadPackageJson(import.meta.url)\n * console.log(`Hello from ${pj.name}@${pj.version}`)\n * ```\n *\n * If the caller is deeper within the project source, then you must provide\n * the appropriate fallback path:\n *\n * ```ts\n * // src/components/something.ts\n * import { loadPackageJson } from 'package-json-from-dist'\n *\n * const pj = loadPackageJson(import.meta.url, '../../package.json')\n * console.log(`Hello from ${pj.name}@${pj.version}`)\n * ```\n *\n * When running from CommmonJS, use `__filename` instead of `import.meta.url`\n *\n * ```ts\n * // src/index.cts\n * import { loadPackageJson } from 'package-json-from-dist'\n *\n * const pj = loadPackageJson(__filename)\n * console.log(`Hello from ${pj.name}@${pj.version}`)\n * ```\n */\nexport const loadPackageJson = (\n from: string | URL,\n pathFromSrc: string = '../package.json',\n) =>\n JSON.parse(readFileSync(findPackageJson(from, pathFromSrc), 'utf8'))\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS,SAAS,WAAW;AACtC,SAAS,qBAAqB;AAE9B,IAAM,KAAK,GAAG,GAAG,eAAe,GAAG;AACnC,IAAM,QAAQ,SAAS,GAAG;AAC1B,IAAM,MAAM,GAAG,GAAG,UAAU,GAAG;AAC/B,IAAM,OAAO,GAAG,GAAG,OAAO,GAAG;AA6CtB,IAAM,kBAAkB,CAC7B,MACA,cAAsB,sBACZ;AACV,QAAM,IACJ,OAAO,SAAS,YAAY,KAAK,WAAW,SAAS,IACnD,cAAc,IAAI,IAClB;AACJ,QAAM,YAAY,QAAQ,CAAC;AAE3B,QAAM,MAAM,UAAU,YAAY,EAAE;AACpC,MAAI,QAAQ,IAAI;AAEd,UAAM,KAAK,UAAU,UAAU,GAAG,MAAM,GAAG,MAAM;AACjD,UAAM,SAAS,UAAU,UAAU,MAAM,GAAG,MAAM;AAGlD,QAAI,OAAO,WAAW,KAAK,GAAG;AAC5B,YAAM,MAAM,OAAO,QAAQ,KAAK,MAAM,MAAM;AAC5C,UAAI,KAAK;AACP,eAAO,QACL,IACA,OAAO,UAAU,GAAG,MAAM,IAAI,MAAM,GACpC,cAAc;MAElB;IACF;AACA,UAAM,UACJ,OAAO,WAAW,GAAG,IACnB,OAAO,MAAM,KAAK,CAAC,EAAE,KAAK,GAAG,IAC7B,OAAO,OAAO,MAAM,GAAG,EAAE,CAAC,CAAC;AAC/B,WAAO,QAAQ,IAAI,SAAS,cAAc;EAC5C,OAAO;AAEL,UAAM,IAAI,UAAU,YAAY,IAAI;AACpC,QAAI,MAAM,IAAI;AACZ,aAAO,QAAQ,UAAU,UAAU,GAAG,CAAC,GAAG,cAAc;IAC1D,OAAO;AACL,aAAO,QAAQ,WAAW,WAAW;IACvC;EACF;AACF;AA6CO,IAAM,kBAAkB,CAC7B,MACA,cAAsB,sBAEtB,KAAK,MAAM,aAAa,gBAAgB,MAAM,WAAW,GAAG,MAAM,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|