@servicetitan/install 40.3.0 → 41.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/install.d.ts +1 -1
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +16 -20
- package/dist/cli/install.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/package-manager/npm-package-manager.d.ts +2 -0
- package/dist/package-manager/npm-package-manager.d.ts.map +1 -1
- package/dist/package-manager/npm-package-manager.js +36 -13
- package/dist/package-manager/npm-package-manager.js.map +1 -1
- package/dist/package-manager/package-manager.d.ts +8 -5
- package/dist/package-manager/package-manager.d.ts.map +1 -1
- package/dist/package-manager/package-manager.js +14 -5
- package/dist/package-manager/package-manager.js.map +1 -1
- package/dist/package-manager/pnpm-package-manager.d.ts +9 -1
- package/dist/package-manager/pnpm-package-manager.d.ts.map +1 -1
- package/dist/package-manager/pnpm-package-manager.js +80 -7
- package/dist/package-manager/pnpm-package-manager.js.map +1 -1
- package/dist/package-manager/utils/with-project-allow-scripts.js +1 -6
- package/dist/package-manager/utils/with-project-allow-scripts.js.map +1 -1
- package/dist/utils/audited-scripts.js +4 -4
- package/dist/utils/audited-scripts.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/npm/index.d.ts +4 -0
- package/dist/utils/npm/index.d.ts.map +1 -0
- package/dist/utils/npm/index.js +22 -0
- package/dist/utils/npm/index.js.map +1 -0
- package/dist/utils/npm/npm-config.d.ts +5 -0
- package/dist/utils/npm/npm-config.d.ts.map +1 -0
- package/dist/utils/npm/npm-config.js +112 -0
- package/dist/utils/npm/npm-config.js.map +1 -0
- package/dist/utils/npm/npm-get-local-prefix.d.ts +9 -0
- package/dist/utils/npm/npm-get-local-prefix.d.ts.map +1 -0
- package/dist/utils/npm/npm-get-local-prefix.js +65 -0
- package/dist/utils/npm/npm-get-local-prefix.js.map +1 -0
- package/dist/utils/npm/npm-who-am-i.d.ts +4 -0
- package/dist/utils/npm/npm-who-am-i.d.ts.map +1 -0
- package/dist/utils/npm/npm-who-am-i.js +37 -0
- package/dist/utils/npm/npm-who-am-i.js.map +1 -0
- package/dist/utils/os.d.ts +2 -2
- package/dist/utils/os.d.ts.map +1 -1
- package/dist/utils/os.js +22 -3
- package/dist/utils/os.js.map +1 -1
- package/dist/utils/pnpm.d.ts +5 -0
- package/dist/utils/pnpm.d.ts.map +1 -0
- package/dist/utils/pnpm.js +87 -0
- package/dist/utils/pnpm.js.map +1 -0
- package/dist/utils/setting.d.ts +6 -0
- package/dist/utils/setting.d.ts.map +1 -0
- package/dist/utils/setting.js +6 -0
- package/dist/utils/setting.js.map +1 -0
- package/package.json +2 -1
- package/src/cli/install.ts +12 -21
- package/src/index.ts +3 -0
- package/src/package-manager/npm-package-manager.ts +38 -19
- package/src/package-manager/package-manager.ts +22 -11
- package/src/package-manager/pnpm-package-manager.ts +96 -9
- package/src/package-manager/utils/with-project-allow-scripts.ts +2 -6
- package/src/utils/audited-scripts.ts +4 -4
- package/src/utils/index.ts +2 -0
- package/src/utils/npm/index.ts +3 -0
- package/src/utils/npm/npm-config.ts +83 -0
- package/src/utils/npm/npm-get-local-prefix.ts +63 -0
- package/src/utils/npm/npm-who-am-i.ts +18 -0
- package/src/utils/os.ts +12 -1
- package/src/utils/pnpm.ts +52 -0
- package/src/utils/setting.ts +5 -0
- package/dist/utils/npm.d.ts +0 -5
- package/dist/utils/npm.d.ts.map +0 -1
- package/dist/utils/npm.js +0 -77
- package/dist/utils/npm.js.map +0 -1
- package/src/utils/npm.ts +0 -44
package/dist/cli/install.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/cli/install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/cli/install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASvD,MAAM,WAAW,IAAI;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,OAAO;;IAChB,IAAI,EAAE,IAAI,CAAC;gBAGC,IAAI,EAAE,IAAI;IAItB,OAAO;IAQP,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,iBAAiB;IAwCzB,OAAO,CAAC,aAAa;IAmCrB,OAAO,CAAC,eAAe;IAUvB,OAAO,KAAK,cAAc,GAEzB;IAED,OAAO,CAAC,GAAG;CAKd"}
|
package/dist/cli/install.js
CHANGED
|
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "Install", {
|
|
|
8
8
|
return Install;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
11
|
+
const _nodefs = /*#__PURE__*/ _interop_require_default(require("node:fs"));
|
|
12
|
+
const _nodeos = /*#__PURE__*/ _interop_require_default(require("node:os"));
|
|
13
|
+
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
14
14
|
const _packagemanager = require("../package-manager");
|
|
15
15
|
const _utils = require("../utils");
|
|
16
16
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
@@ -72,28 +72,24 @@ var _packageManager = /*#__PURE__*/ new WeakMap();
|
|
|
72
72
|
class Install {
|
|
73
73
|
execute() {
|
|
74
74
|
this.log(`install cli v${(0, _utils.getVersion)()}`);
|
|
75
|
-
this.
|
|
75
|
+
this.configureSettings();
|
|
76
76
|
const env = this.configureNpmToken();
|
|
77
77
|
this.installPackages(env);
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
configureSettings() {
|
|
80
80
|
if ((0, _utils.isCI)() || this.args.fix) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
try {
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
for (const setting of this.packageManager.getRecommendedSettings(this.args)){
|
|
85
|
+
if (!setting.isSet()) {
|
|
86
|
+
this.log(`Setting ${setting.description} ...`);
|
|
87
|
+
setting.set();
|
|
88
|
+
}
|
|
86
89
|
}
|
|
87
|
-
this.log('Configuring npx to require confirmation ...');
|
|
88
|
-
(0, _utils.runCommand)('npm', [
|
|
89
|
-
'config',
|
|
90
|
-
'set',
|
|
91
|
-
'yes=false',
|
|
92
|
-
'--location=user'
|
|
93
|
-
]);
|
|
94
90
|
} catch (e) {
|
|
95
91
|
console.warn(String(e));
|
|
96
|
-
console.warn('Failed to configure
|
|
92
|
+
console.warn('Failed to configure recommended package manager settings');
|
|
97
93
|
}
|
|
98
94
|
}
|
|
99
95
|
configureNpmToken() {
|
|
@@ -117,10 +113,10 @@ class Install {
|
|
|
117
113
|
'set',
|
|
118
114
|
`${AUTH_TOKEN_KEY}=${token}`
|
|
119
115
|
]);
|
|
120
|
-
if (!
|
|
116
|
+
if (!_nodefs.default.existsSync('.npmrc')) {
|
|
121
117
|
return;
|
|
122
118
|
}
|
|
123
|
-
const npmrc =
|
|
119
|
+
const npmrc = _nodefs.default.readFileSync('.npmrc', 'utf-8');
|
|
124
120
|
const { authToken } = (_ref = (_AUTH_TOKEN_REGEX_exec = AUTH_TOKEN_REGEX.exec(npmrc)) === null || _AUTH_TOKEN_REGEX_exec === void 0 ? void 0 : _AUTH_TOKEN_REGEX_exec.groups) !== null && _ref !== void 0 ? _ref : {};
|
|
125
121
|
(0, _utils.debug)({
|
|
126
122
|
authToken
|
|
@@ -145,7 +141,7 @@ class Install {
|
|
|
145
141
|
]);
|
|
146
142
|
}
|
|
147
143
|
fetchNpmToken() {
|
|
148
|
-
const tempDirPath =
|
|
144
|
+
const tempDirPath = _nodefs.default.mkdtempSync(_nodepath.default.join(_nodeos.default.tmpdir(), 'st-install-'));
|
|
149
145
|
try {
|
|
150
146
|
if (!(0, _utils.gitCloneRepo)({
|
|
151
147
|
destination: tempDirPath,
|
|
@@ -153,7 +149,7 @@ class Install {
|
|
|
153
149
|
})) {
|
|
154
150
|
throw new Error(`could not clone servicetitan/${REPO_NAME}`);
|
|
155
151
|
}
|
|
156
|
-
const npmJson = (0, _utils.readJson)(
|
|
152
|
+
const npmJson = (0, _utils.readJson)(_nodepath.default.join(tempDirPath, '.npm.json'));
|
|
157
153
|
(0, _utils.debug)('install:fetch-npm-token', {
|
|
158
154
|
npmJson
|
|
159
155
|
});
|
|
@@ -172,7 +168,7 @@ class Install {
|
|
|
172
168
|
console.warn(String(e));
|
|
173
169
|
} finally{
|
|
174
170
|
try {
|
|
175
|
-
|
|
171
|
+
_nodefs.default.rmSync(tempDirPath, {
|
|
176
172
|
recursive: true,
|
|
177
173
|
force: true
|
|
178
174
|
});
|
package/dist/cli/install.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/install.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport type { AllowScripts } from '../package-manager';\nimport { getPackageManager, PackageManager } from '../package-manager';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/cli/install.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport type { AllowScripts } from '../package-manager';\nimport { getPackageManager, PackageManager } from '../package-manager';\nimport { debug, getVersion, gitCloneRepo, isCI, npmWhoAmI, readJson, runCommand } from '../utils';\n\nconst REPO_NAME = 'frontend-dev-config';\nconst AUTH_TOKEN_KEY = '//registry.npmjs.org/:_authToken';\nconst AUTH_TOKEN_REGEX = /^\\/\\/registry\\.npmjs\\.org\\/:_authToken=\\s*(?<authToken>.+)/m;\nconst ENVIRONMENT_VARIABLE_REGEX = /\\${(?<environmentVariable>[^}]+)}/;\n\nexport interface Args {\n allowScripts?: AllowScripts;\n fix?: boolean;\n minReleaseAge?: false;\n quiet?: boolean;\n token?: boolean;\n}\n\nexport class Install {\n args: Args;\n #packageManager: PackageManager | undefined;\n\n constructor(args: Args) {\n this.args = args;\n }\n\n execute() {\n this.log(`install cli v${getVersion()}`);\n\n this.configureSettings();\n const env = this.configureNpmToken();\n this.installPackages(env);\n }\n\n private configureSettings() {\n if (isCI() || this.args.fix) {\n return;\n }\n\n try {\n for (const setting of this.packageManager.getRecommendedSettings(this.args)) {\n if (!setting.isSet()) {\n this.log(`Setting ${setting.description} ...`);\n setting.set();\n }\n }\n } catch (e) {\n console.warn(String(e));\n console.warn('Failed to configure recommended package manager settings');\n }\n }\n\n private configureNpmToken() {\n if (isCI() || this.args.fix || this.args.token === false) {\n return;\n }\n\n this.log('Configuring NPM token ...');\n\n if (this.args.token !== true) {\n if (npmWhoAmI() === 'st-team') {\n return;\n }\n }\n\n const token = this.fetchNpmToken();\n if (!token) {\n return;\n }\n\n runCommand('npm', ['config', 'set', `${AUTH_TOKEN_KEY}=${token}`]);\n\n if (!fs.existsSync('.npmrc')) {\n return;\n }\n\n const npmrc = fs.readFileSync('.npmrc', 'utf-8');\n const { authToken } = AUTH_TOKEN_REGEX.exec(npmrc)?.groups ?? {};\n debug({ authToken });\n if (!authToken) {\n return;\n }\n\n const { environmentVariable } = ENVIRONMENT_VARIABLE_REGEX.exec(authToken)?.groups ?? {};\n debug({ environmentVariable });\n if (environmentVariable) {\n return { [environmentVariable]: token };\n }\n\n runCommand('npm', ['config', 'delete', '--location=project', AUTH_TOKEN_KEY]);\n }\n\n private fetchNpmToken() {\n const tempDirPath = fs.mkdtempSync(path.join(os.tmpdir(), 'st-install-'));\n try {\n if (!gitCloneRepo({ destination: tempDirPath, name: REPO_NAME })) {\n throw new Error(`could not clone servicetitan/${REPO_NAME}`);\n }\n\n const npmJson = readJson(path.join(tempDirPath, '.npm.json'));\n debug('install:fetch-npm-token', { npmJson });\n\n if (!((npmJson && typeof npmJson === 'object') || Array.isArray(npmJson))) {\n throw new Error('.npm.json is not an object');\n }\n\n const { readOnlyToken: authToken } = npmJson;\n if (!authToken) {\n throw new Error('.npm.json does not contain auth token');\n }\n\n if (typeof authToken !== 'string') {\n throw new Error('.npm.json auth token is not a string');\n }\n\n return Buffer.from(authToken, 'base64').toString('utf-8');\n } catch (e) {\n console.warn(String(e));\n } finally {\n try {\n fs.rmSync(tempDirPath, { recursive: true, force: true });\n } catch {\n // ignore\n }\n }\n }\n\n private installPackages(env?: Record<string, string>) {\n if (this.args.token) {\n return;\n }\n\n this.log(`Running ${this.packageManager.command} install`);\n\n this.packageManager.installPackages(this.args, { env, stdio: 'inherit' });\n }\n\n private get packageManager() {\n return (this.#packageManager ??= getPackageManager());\n }\n\n private log(message: string) {\n if (!this.args.quiet) {\n console.log(message);\n }\n }\n}\n"],"names":["Install","REPO_NAME","AUTH_TOKEN_KEY","AUTH_TOKEN_REGEX","ENVIRONMENT_VARIABLE_REGEX","execute","log","getVersion","configureSettings","env","configureNpmToken","installPackages","isCI","args","fix","setting","packageManager","getRecommendedSettings","isSet","description","set","e","console","warn","String","token","npmWhoAmI","fetchNpmToken","runCommand","fs","existsSync","npmrc","readFileSync","authToken","exec","groups","debug","environmentVariable","tempDirPath","mkdtempSync","path","join","os","tmpdir","gitCloneRepo","destination","name","Error","npmJson","readJson","Array","isArray","readOnlyToken","Buffer","from","toString","rmSync","recursive","force","command","stdio","getPackageManager","message","quiet"],"mappings":"AAAA,6BAA6B;;;;+BAqBhBA;;;eAAAA;;;+DApBE;+DACA;iEACE;gCAEiC;uBACqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvF,MAAMC,Y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c,UAAU;gBAC/B,MAAM,IAAIc,MAAM;YACpB;YAEA,OAAOM,OAAOC,IAAI,CAACrB,WAAW,UAAUsB,QAAQ,CAAC;QACrD,EAAE,OAAOlC,GAAG;YACRC,QAAQC,IAAI,CAACC,OAAOH;QACxB,SAAU;YACN,IAAI;gBACAQ,eAAE,CAAC2B,MAAM,CAAClB,aAAa;oBAAEmB,WAAW;oBAAMC,OAAO;gBAAK;YAC1D,EAAE,eAAM;YACJ,SAAS;YACb;QACJ;IACJ;IAEQ/C,gBAAgBF,GAA4B,EAAE;QAClD,IAAI,IAAI,CAACI,IAAI,CAACY,KAAK,EAAE;YACjB;QACJ;QAEA,IAAI,CAACnB,GAAG,CAAC,CAAC,QAAQ,EAAE,IAAI,CAACU,cAAc,CAAC2C,OAAO,CAAC,QAAQ,CAAC;QAEzD,IAAI,CAAC3C,cAAc,CAACL,eAAe,CAAC,IAAI,CAACE,IAAI,EAAE;YAAEJ;YAAKmD,OAAO;QAAU;IAC3E;IAEA,IAAY5C,iBAAiB;;QACzB,sCAAa,uEAAL,IAAI,EAAC,iGAAoB6C,IAAAA,iCAAiB;IACtD;IAEQvD,IAAIwD,OAAe,EAAE;QACzB,IAAI,CAAC,IAAI,CAACjD,IAAI,CAACkD,KAAK,EAAE;YAClBzC,QAAQhB,GAAG,CAACwD;QAChB;IACJ;IA3HA,YAAYjD,IAAU,CAAE;QAHxBA,uBAAAA,QAAAA,KAAAA;QACA,gCAAA;;mBAAA,KAAA;;QAGI,IAAI,CAACA,IAAI,GAAGA;IAChB;AA0HJ"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { PackageManager, getPackageManager } from './package-manager';
|
|
2
2
|
export type { DeclaredVersionQuery, ResolvedVersionQuery } from './package-manager';
|
|
3
|
-
export { AUDITED_SCRIPTS, gitCloneRepo, gitIsReachable, isCI, npmWhoAmI, versionCompare, } from './utils';
|
|
3
|
+
export { AUDITED_SCRIPTS, gitCloneRepo, gitIsReachable, isCI, npmGetLocalPrefix, npmGetProjectConfig, npmWhoAmI, pnpmGetProjectConfig, versionCompare, } from './utils';
|
|
4
4
|
export type { AuditedScript } from './utils';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtE,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EACH,eAAe,EACf,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,SAAS,EACT,cAAc,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtE,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EACH,eAAe,EACf,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,oBAAoB,EACpB,cAAc,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,9 +27,18 @@ _export(exports, {
|
|
|
27
27
|
get isCI () {
|
|
28
28
|
return _utils.isCI;
|
|
29
29
|
},
|
|
30
|
+
get npmGetLocalPrefix () {
|
|
31
|
+
return _utils.npmGetLocalPrefix;
|
|
32
|
+
},
|
|
33
|
+
get npmGetProjectConfig () {
|
|
34
|
+
return _utils.npmGetProjectConfig;
|
|
35
|
+
},
|
|
30
36
|
get npmWhoAmI () {
|
|
31
37
|
return _utils.npmWhoAmI;
|
|
32
38
|
},
|
|
39
|
+
get pnpmGetProjectConfig () {
|
|
40
|
+
return _utils.pnpmGetProjectConfig;
|
|
41
|
+
},
|
|
33
42
|
get versionCompare () {
|
|
34
43
|
return _utils.versionCompare;
|
|
35
44
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { PackageManager, getPackageManager } from './package-manager';\nexport type { DeclaredVersionQuery, ResolvedVersionQuery } from './package-manager';\nexport {\n AUDITED_SCRIPTS,\n gitCloneRepo,\n gitIsReachable,\n isCI,\n npmWhoAmI,\n versionCompare,\n} from './utils';\nexport type { AuditedScript } from './utils';\n"],"names":["AUDITED_SCRIPTS","PackageManager","getPackageManager","gitCloneRepo","gitIsReachable","isCI","npmWhoAmI","versionCompare"],"mappings":";;;;;;;;;;;QAGIA;eAAAA,sBAAe;;QAHVC;eAAAA,8BAAc;;QAAEC;eAAAA,iCAAiB;;QAItCC;eAAAA,mBAAY;;QACZC;eAAAA,qBAAc;;QACdC;eAAAA,WAAI;;QACJC;eAAAA,gBAAS;;QACTC;eAAAA,qBAAc;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { PackageManager, getPackageManager } from './package-manager';\nexport type { DeclaredVersionQuery, ResolvedVersionQuery } from './package-manager';\nexport {\n AUDITED_SCRIPTS,\n gitCloneRepo,\n gitIsReachable,\n isCI,\n npmGetLocalPrefix,\n npmGetProjectConfig,\n npmWhoAmI,\n pnpmGetProjectConfig,\n versionCompare,\n} from './utils';\nexport type { AuditedScript } from './utils';\n"],"names":["AUDITED_SCRIPTS","PackageManager","getPackageManager","gitCloneRepo","gitIsReachable","isCI","npmGetLocalPrefix","npmGetProjectConfig","npmWhoAmI","pnpmGetProjectConfig","versionCompare"],"mappings":";;;;;;;;;;;QAGIA;eAAAA,sBAAe;;QAHVC;eAAAA,8BAAc;;QAAEC;eAAAA,iCAAiB;;QAItCC;eAAAA,mBAAY;;QACZC;eAAAA,qBAAc;;QACdC;eAAAA,WAAI;;QACJC;eAAAA,wBAAiB;;QACjBC;eAAAA,0BAAmB;;QACnBC;eAAAA,gBAAS;;QACTC;eAAAA,2BAAoB;;QACpBC;eAAAA,qBAAc;;;gCAXgC;uBAY3C"}
|
|
@@ -16,6 +16,7 @@ export declare class NpmPackageManager extends PackageManager<NpmLockFile> {
|
|
|
16
16
|
readonly lockFileName = "package-lock.json";
|
|
17
17
|
clearCache(): void;
|
|
18
18
|
getDeclaredVersion({ workspacePackage, declaredBy, dependency, }: DeclaredVersionQuery): string | undefined;
|
|
19
|
+
getRecommendedSettings(args: InstallArgs): import("../utils").Setting[];
|
|
19
20
|
getResolvedVersion({ workspacePackage, dependency }: ResolvedVersionQuery): string | undefined;
|
|
20
21
|
installPackages(args?: InstallArgs, options?: Parameters<typeof runCommand>[2]): void;
|
|
21
22
|
protected parseLockFile(): NpmLockFile | undefined;
|
|
@@ -30,6 +31,7 @@ export declare class NpmPackageManager extends PackageManager<NpmLockFile> {
|
|
|
30
31
|
private findEntry;
|
|
31
32
|
private runRebuild;
|
|
32
33
|
private resolveMinReleaseAgeFlags;
|
|
34
|
+
private getMinReleaseAgeSettings;
|
|
33
35
|
private hasConfiguredMinReleaseAge;
|
|
34
36
|
private runProjectPostinstall;
|
|
35
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm-package-manager.d.ts","sourceRoot":"","sources":["../../src/package-manager/npm-package-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAIH,UAAU,
|
|
1
|
+
{"version":3,"file":"npm-package-manager.d.ts","sourceRoot":"","sources":["../../src/package-manager/npm-package-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAIH,UAAU,EAIb,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,m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
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const _nodefs = /*#__PURE__*/ _interop_require_default(require("node:fs"));
|
|
12
12
|
const _utils = require("../utils");
|
|
13
13
|
const _packagemanager = require("./package-manager");
|
|
14
14
|
const _utils1 = require("./utils");
|
|
@@ -28,7 +28,10 @@ function _interop_require_default(obj) {
|
|
|
28
28
|
default: obj
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
/*
|
|
32
|
+
* npm added `min-release-age-exclude` in 11.17.0. Earlier versions reject it
|
|
33
|
+
* through `npm config set` and ignore manually configured values.
|
|
34
|
+
*/ const MIN_NPM_VERSION_FOR_RELEASE_AGE = '11.17.0';
|
|
32
35
|
class NpmPackageManager extends _packagemanager.PackageManager {
|
|
33
36
|
clearCache() {
|
|
34
37
|
(0, _utils.runCommand)(this.command, [
|
|
@@ -46,6 +49,12 @@ class NpmPackageManager extends _packagemanager.PackageManager {
|
|
|
46
49
|
});
|
|
47
50
|
return (_ref = entry === null || entry === void 0 ? void 0 : (_entry_dependencies = entry.dependencies) === null || _entry_dependencies === void 0 ? void 0 : _entry_dependencies[dependency]) !== null && _ref !== void 0 ? _ref : entry === null || entry === void 0 ? void 0 : (_entry_peerDependencies = entry.peerDependencies) === null || _entry_peerDependencies === void 0 ? void 0 : _entry_peerDependencies[dependency];
|
|
48
51
|
}
|
|
52
|
+
getRecommendedSettings(args) {
|
|
53
|
+
return (0, _utils.toNpmConfigSettings)([
|
|
54
|
+
'yes=false',
|
|
55
|
+
...this.getMinReleaseAgeSettings(args)
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
49
58
|
getResolvedVersion({ workspacePackage, dependency }) {
|
|
50
59
|
var _this_findEntry;
|
|
51
60
|
return (_this_findEntry = this.findEntry({
|
|
@@ -124,7 +133,7 @@ class NpmPackageManager extends _packagemanager.PackageManager {
|
|
|
124
133
|
return undefined;
|
|
125
134
|
}
|
|
126
135
|
try {
|
|
127
|
-
return JSON.parse(
|
|
136
|
+
return JSON.parse(_nodefs.default.readFileSync(lockFilePath, 'utf-8'));
|
|
128
137
|
} catch (unused) {
|
|
129
138
|
return undefined;
|
|
130
139
|
}
|
|
@@ -139,6 +148,9 @@ class NpmPackageManager extends _packagemanager.PackageManager {
|
|
|
139
148
|
*/ findEntry({ workspacePackage, package: packageName }) {
|
|
140
149
|
var _ref;
|
|
141
150
|
var _this_getLockFile;
|
|
151
|
+
if (workspacePackage === undefined) {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
142
154
|
const packages = (_this_getLockFile = this.getLockFile()) === null || _this_getLockFile === void 0 ? void 0 : _this_getLockFile.packages;
|
|
143
155
|
const entry = (_ref = packages === null || packages === void 0 ? void 0 : packages[`${workspacePackage}/node_modules/${packageName}`]) !== null && _ref !== void 0 ? _ref : packages === null || packages === void 0 ? void 0 : packages[`node_modules/${packageName}`];
|
|
144
156
|
if ((entry === null || entry === void 0 ? void 0 : entry.link) && entry.resolved) {
|
|
@@ -176,15 +188,33 @@ class NpmPackageManager extends _packagemanager.PackageManager {
|
|
|
176
188
|
'--version'
|
|
177
189
|
]).trim();
|
|
178
190
|
if ((0, _utils.versionCompare)(version, MIN_NPM_VERSION_FOR_RELEASE_AGE) < 0) {
|
|
179
|
-
console.warn(`WARNING: npm ${version} does not support minimum release age
|
|
191
|
+
console.warn(`WARNING: npm ${version} does not support minimum release age exclusions. Installing without minimum release age protection.`);
|
|
180
192
|
return [];
|
|
181
193
|
}
|
|
194
|
+
const excludeFlags = resolved.exclude.map((pattern)=>`--min-release-age-exclude=${pattern}`);
|
|
182
195
|
if (this.hasConfiguredMinReleaseAge()) {
|
|
183
196
|
return [];
|
|
184
197
|
}
|
|
185
198
|
return [
|
|
186
199
|
`--min-release-age=${resolved.days}`,
|
|
187
|
-
...
|
|
200
|
+
...excludeFlags
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
getMinReleaseAgeSettings(args) {
|
|
204
|
+
const resolved = (0, _utils1.resolveMinReleaseAge)(args.minReleaseAge);
|
|
205
|
+
if (!resolved) {
|
|
206
|
+
return [];
|
|
207
|
+
}
|
|
208
|
+
const version = (0, _utils.runCommand)(this.command, [
|
|
209
|
+
'--version'
|
|
210
|
+
]).trim();
|
|
211
|
+
if ((0, _utils.versionCompare)(version, MIN_NPM_VERSION_FOR_RELEASE_AGE) < 0) {
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
const excludeSettings = resolved.exclude.map((pattern)=>`min-release-age-exclude=${pattern}`);
|
|
215
|
+
return [
|
|
216
|
+
`min-release-age=${resolved.days}`,
|
|
217
|
+
...excludeSettings
|
|
188
218
|
];
|
|
189
219
|
}
|
|
190
220
|
hasConfiguredMinReleaseAge() {
|
|
@@ -194,14 +224,7 @@ class NpmPackageManager extends _packagemanager.PackageManager {
|
|
|
194
224
|
'list',
|
|
195
225
|
'--json'
|
|
196
226
|
]));
|
|
197
|
-
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
/*
|
|
201
|
-
* On npm >=11.10.0 <11.14.0, min-release-age is flattened into an
|
|
202
|
-
* absolute `before` cutoff date and removed from the config, so
|
|
203
|
-
* fall back to checking that cutoff instead.
|
|
204
|
-
*/ return typeof config.before === 'string' && new Date(config.before).getTime() < Date.now();
|
|
227
|
+
return Number(config['min-release-age']) > 0;
|
|
205
228
|
} catch (unused) {
|
|
206
229
|
return false;
|
|
207
230
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/package-manager/npm-package-manager.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'fs';\nimport {\n AUDITED_SCRIPTS,\n getPackagesWithInstallScripts,\n isCI,\n runCommand,\n versionCompare,\n warnUntrustedInstallScripts,\n} from '../utils';\nimport type { DeclaredVersionQuery, InstallArgs, ResolvedVersionQuery } from './package-manager';\nimport { PackageManager } from './package-manager';\nimport type { TrustedScripts } from './utils';\nimport {\n filterTrustedScripts,\n logAllowedScripts,\n parseAllowScripts,\n resolveAllowScripts,\n resolveMinReleaseAge,\n usesStartup,\n withProjectAllowScripts,\n} from './utils';\n\nconst MIN_NPM_VERSION_FOR_RELEASE_AGE = '11.10.0';\n\ninterface NpmLockFileEntry {\n version?: string;\n resolved?: string;\n link?: boolean;\n dependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\nexport interface NpmLockFile {\n packages?: Record<string, NpmLockFileEntry>;\n}\n\nexport class NpmPackageManager extends PackageManager<NpmLockFile> {\n readonly command = 'npm';\n readonly lockFileName = 'package-lock.json';\n\n clearCache() {\n runCommand(this.command, ['cache', 'clear', '--force']);\n }\n\n getDeclaredVersion({\n workspacePackage,\n declaredBy,\n dependency,\n }: DeclaredVersionQuery): string | undefined {\n const entry = this.findEntry({ workspacePackage, package: declaredBy });\n return entry?.dependencies?.[dependency] ?? entry?.peerDependencies?.[dependency];\n }\n\n getResolvedVersion({ workspacePackage, dependency }: ResolvedVersionQuery): string | undefined {\n return this.findEntry({ workspacePackage, package: dependency })?.version;\n }\n\n installPackages(args: InstallArgs = {}, options?: Parameters<typeof runCommand>[2]) {\n const builtInIgnoredScripts = AUDITED_SCRIPTS.filter(script => script.action === 'ignore');\n const builtInAllowedScripts = usesStartup()\n ? AUDITED_SCRIPTS.filter(script => script.action === 'allow')\n : [];\n const builtInAllowlist = builtInAllowedScripts.map(script => script.name);\n const allowScripts = resolveAllowScripts(args.allowScripts ?? [], builtInAllowlist);\n const userAllowlist = Array.isArray(args.allowScripts)\n ? parseAllowScripts(args.allowScripts)\n : [];\n const minReleaseAgeFlags = this.resolveMinReleaseAgeFlags(args);\n\n if (!args.quiet) {\n logAllowedScripts(allowScripts, builtInAllowlist);\n }\n\n runCommand(\n this.command,\n [\n isCI() ? 'ci' : 'i',\n '--audit=false',\n '--fund=false',\n '--legacy-peer-deps',\n ...(allowScripts !== true ? ['--ignore-scripts'] : []),\n ...minReleaseAgeFlags,\n ...(args.fix ? ['--package-lock-only', '--prefer-dedupe'] : []),\n ],\n options\n );\n\n try {\n if (args.fix) {\n return;\n }\n let trusted: TrustedScripts | undefined;\n if (Array.isArray(allowScripts)) {\n try {\n trusted = filterTrustedScripts(\n getPackagesWithInstallScripts(),\n builtInAllowedScripts,\n userAllowlist\n );\n } catch (error) {\n console.error(String(error));\n console.error('Failed to determine trusted install scripts');\n process.exitCode = 1;\n }\n }\n /*\n * Rebuild applies when allowScripts is a non-empty explicit list:\n * `true` means npm install already ran every script, `false`\n * means the user opted out.\n */\n if (trusted && trusted.specs.length > 0) {\n withProjectAllowScripts(trusted.names, () => this.runRebuild(trusted.specs));\n }\n /*\n * Warn against the effective allowlist so teams can see which\n * scripts they should add to --allow-scripts. Skip when the user\n * explicitly opted out (`false`); they made an informed choice.\n */\n if (allowScripts !== false) {\n warnUntrustedInstallScripts(\n trusted?.specs ?? builtInAllowlist,\n builtInIgnoredScripts\n );\n }\n /*\n * When allowScripts is `true`, npm already ran project postinstall.\n * In other cases, we run it manually. Note, `false` only ignores\n * package scripts, the project postinstall is always trusted.\n */\n if (allowScripts !== true) {\n this.runProjectPostinstall(options);\n }\n } finally {\n this.reset();\n }\n }\n\n protected parseLockFile(): NpmLockFile | undefined {\n const lockFilePath = this.getLockFilePath();\n if (!lockFilePath) {\n return undefined;\n }\n try {\n return JSON.parse(fs.readFileSync(lockFilePath, 'utf-8'));\n } catch {\n return undefined;\n }\n }\n\n /**\n * Looks up a lockfile entry for the given workspace package, falling back\n * to the hoisted root entry. `workspacePackage` is the package's relative\n * path from the repo root; the empty string `''` denotes the root\n * workspace package itself, matching npm's own lockfile key convention.\n * Follows link entries to the resolved workspace package, so callers see\n * the workspace package's own metadata rather than the symlink stub.\n */\n private findEntry({\n workspacePackage,\n package: packageName,\n }: {\n workspacePackage: string;\n package: string;\n }): NpmLockFileEntry | undefined {\n const packages = this.getLockFile()?.packages;\n const entry =\n packages?.[`${workspacePackage}/node_modules/${packageName}`] ??\n packages?.[`node_modules/${packageName}`];\n if (entry?.link && entry.resolved) {\n return packages?.[entry.resolved];\n }\n return entry;\n }\n\n private runRebuild(scripts: string[]) {\n try {\n runCommand(this.command, ['rebuild', ...scripts], {\n stdio: ['inherit', 'inherit', 'pipe'],\n });\n } catch (error) {\n console.error(String(error));\n console.error(`Failed to run allowed scripts: ${scripts.join(', ')}`);\n process.exitCode = 1;\n }\n }\n\n private resolveMinReleaseAgeFlags(args: InstallArgs): string[] {\n if (args.fix) {\n return [];\n }\n\n const resolved = resolveMinReleaseAge(args.minReleaseAge);\n if (!resolved) {\n return [];\n }\n\n const version = runCommand(this.command, ['--version']).trim();\n if (versionCompare(version, MIN_NPM_VERSION_FOR_RELEASE_AGE) < 0) {\n console.warn(\n `WARNING: npm ${version} does not support minimum release age protection. Installing without it.`\n );\n return [];\n }\n\n if (this.hasConfiguredMinReleaseAge()) {\n return [];\n }\n\n return [\n `--min-release-age=${resolved.days}`,\n ...resolved.exclude.map(pattern => `--min-release-age-exclude=${pattern}`),\n ];\n }\n\n private hasConfiguredMinReleaseAge(): boolean {\n try {\n const config = JSON.parse(runCommand(this.command, ['config', 'list', '--json']));\n if (Number(config['min-release-age']) > 0) {\n return true;\n }\n /*\n * On npm >=11.10.0 <11.14.0, min-release-age is flattened into an\n * absolute `before` cutoff date and removed from the config, so\n * fall back to checking that cutoff instead.\n */\n return (\n typeof config.before === 'string' && new Date(config.before).getTime() < Date.now()\n );\n } catch {\n return false;\n }\n }\n\n private runProjectPostinstall(options?: Parameters<typeof runCommand>[2]) {\n try {\n runCommand(this.command, ['run', 'postinstall', '--if-present'], options);\n } catch {\n process.exitCode = 1;\n }\n }\n}\n"],"names":["NpmPackageManager","MIN_NPM_VERSION_FOR_RELEASE_AGE","PackageManager","clearCache","runCommand","command","getDeclaredVersion","workspacePackage","declaredBy","dependency","entry","findEntry","package","dependencies","peerDependencies","getResolvedVersion","version","installPackages","args","options","builtInIgnoredScripts","AUDITED_SCRIPTS","filter","script","action","builtInAllowedScripts","usesStartup","builtInAllowlist","map","name","allowScripts","resolveAllowScripts","userAllowlist","Array","isArray","parseAllowScripts","minReleaseAgeFlags","resolveMinReleaseAgeFlags","quiet","logAllowedScripts","isCI","fix","trusted","filterTrustedScripts","getPackagesWithInstallScripts","error","console","String","process","exitCode","specs","length","withProjectAllowScripts","names","runRebuild","warnUntrustedInstallScripts","runProjectPostinstall","reset","parseLockFile","lockFilePath","getLockFilePath","undefined","JSON","parse","fs","readFileSync","packageName","packages","getLockFile","link","resolved","scripts","stdio","join","resolveMinReleaseAge","minReleaseAge","trim","versionCompare","warn","hasConfiguredMinReleaseAge","days","exclude","pattern","config","Number","before","Date","getTime","now","lockFileName"],"mappings":"AAAA,6BAA6B;;;;+BAqChBA;;;eAAAA;;;2DApCE;uBAQR;gCAEwB;wBAUxB;;;;;;;;;;;;;;;;;AAEP,MAAMC,kCAAkC;AAcjC,MAAMD,0BAA0BE,8BAAc;IAIjDC,aAAa;QACTC,IAAAA,iBAAU,EAAC,IAAI,CAACC,OAAO,EAAE;YAAC;YAAS;YAAS;SAAU;IAC1D;IAEAC,mBAAmB,EACfC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACS,EAAsB;;YAElCC,qBAAqCA;QAD5C,MAAMA,QAAQ,IAAI,CAACC,SAAS,CAAC;YAAEJ;YAAkBK,SAASJ;QAAW;QACrE,eAAOE,kBAAAA,6BAAAA,sBAAAA,MAAOG,YAAY,cAAnBH,0CAAAA,mBAAqB,CAACD,WAAW,uCAAIC,kBAAAA,6BAAAA,0BAAAA,MAAOI,gBAAgB,cAAvBJ,8CAAAA,uBAAyB,CAACD,WAAW;IACrF;IAEAM,mBAAmB,EAAER,gBAAgB,EAAEE,UAAU,EAAwB,EAAsB;YACpF;QAAP,QAAO,kBAAA,IAAI,CAACE,SAAS,CAAC;YAAEJ;YAAkBK,SAASH;QAAW,gBAAvD,sCAAA,gBAA2DO,OAAO;IAC7E;IAEAC,gBAAgBC,OAAoB,CAAC,CAAC,EAAEC,OAA0C,EAAE;YAMvCD;QALzC,MAAME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sBrC,OAA0C,EAAE;QACtE,IAAI;YACAf,IAAAA,iBAAU,EAAC,IAAI,CAACC,OAAO,EAAE;gBAAC;gBAAO;gBAAe;aAAe,EAAEc;QACrE,EAAE,eAAM;YACJ6B,QAAQC,QAAQ,GAAG;QACvB;IACJ;;QA3MG,gBACH,uBAAS5C,WAAU,QACnB,uBAASoF,gBAAe;;AA0M5B"}
|
|
1
|
+
{"version":3,"sources":["../../src/package-manager/npm-package-manager.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'node:fs';\nimport {\n AUDITED_SCRIPTS,\n getPackagesWithInstallScripts,\n isCI,\n runCommand,\n toNpmConfigSettings,\n versionCompare,\n warnUntrustedInstallScripts,\n} from '../utils';\nimport type { DeclaredVersionQuery, InstallArgs, ResolvedVersionQuery } from './package-manager';\nimport { PackageManager } from './package-manager';\nimport type { TrustedScripts } from './utils';\nimport {\n filterTrustedScripts,\n logAllowedScripts,\n parseAllowScripts,\n resolveAllowScripts,\n resolveMinReleaseAge,\n usesStartup,\n withProjectAllowScripts,\n} from './utils';\n\n/*\n * npm added `min-release-age-exclude` in 11.17.0. Earlier versions reject it\n * through `npm config set` and ignore manually configured values.\n */\nconst MIN_NPM_VERSION_FOR_RELEASE_AGE = '11.17.0';\n\ninterface NpmLockFileEntry {\n version?: string;\n resolved?: string;\n link?: boolean;\n dependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\nexport interface NpmLockFile {\n packages?: Record<string, NpmLockFileEntry>;\n}\n\nexport class NpmPackageManager extends PackageManager<NpmLockFile> {\n readonly command = 'npm';\n readonly lockFileName = 'package-lock.json';\n\n clearCache() {\n runCommand(this.command, ['cache', 'clear', '--force']);\n }\n\n getDeclaredVersion({\n workspacePackage,\n declaredBy,\n dependency,\n }: DeclaredVersionQuery): string | undefined {\n const entry = this.findEntry({ workspacePackage, package: declaredBy });\n return entry?.dependencies?.[dependency] ?? entry?.peerDependencies?.[dependency];\n }\n\n getRecommendedSettings(args: InstallArgs) {\n return toNpmConfigSettings(['yes=false', ...this.getMinReleaseAgeSettings(args)]);\n }\n\n getResolvedVersion({ workspacePackage, dependency }: ResolvedVersionQuery): string | undefined {\n return this.findEntry({ workspacePackage, package: dependency })?.version;\n }\n\n installPackages(args: InstallArgs = {}, options?: Parameters<typeof runCommand>[2]) {\n const builtInIgnoredScripts = AUDITED_SCRIPTS.filter(script => script.action === 'ignore');\n const builtInAllowedScripts = usesStartup()\n ? AUDITED_SCRIPTS.filter(script => script.action === 'allow')\n : [];\n const builtInAllowlist = builtInAllowedScripts.map(script => script.name);\n const allowScripts = resolveAllowScripts(args.allowScripts ?? [], builtInAllowlist);\n const userAllowlist = Array.isArray(args.allowScripts)\n ? parseAllowScripts(args.allowScripts)\n : [];\n const minReleaseAgeFlags = this.resolveMinReleaseAgeFlags(args);\n\n if (!args.quiet) {\n logAllowedScripts(allowScripts, builtInAllowlist);\n }\n\n runCommand(\n this.command,\n [\n isCI() ? 'ci' : 'i',\n '--audit=false',\n '--fund=false',\n '--legacy-peer-deps',\n ...(allowScripts !== true ? ['--ignore-scripts'] : []),\n ...minReleaseAgeFlags,\n ...(args.fix ? ['--package-lock-only', '--prefer-dedupe'] : []),\n ],\n options\n );\n\n try {\n if (args.fix) {\n return;\n }\n let trusted: TrustedScripts | undefined;\n if (Array.isArray(allowScripts)) {\n try {\n trusted = filterTrustedScripts(\n getPackagesWithInstallScripts(),\n builtInAllowedScripts,\n userAllowlist\n );\n } catch (error) {\n console.error(String(error));\n console.error('Failed to determine trusted install scripts');\n process.exitCode = 1;\n }\n }\n /*\n * Rebuild applies when allowScripts is a non-empty explicit list:\n * `true` means npm install already ran every script, `false`\n * means the user opted out.\n */\n if (trusted && trusted.specs.length > 0) {\n withProjectAllowScripts(trusted.names, () => this.runRebuild(trusted.specs));\n }\n /*\n * Warn against the effective allowlist so teams can see which\n * scripts they should add to --allow-scripts. Skip when the user\n * explicitly opted out (`false`); they made an informed choice.\n */\n if (allowScripts !== false) {\n warnUntrustedInstallScripts(\n trusted?.specs ?? builtInAllowlist,\n builtInIgnoredScripts\n );\n }\n /*\n * When allowScripts is `true`, npm already ran project postinstall.\n * In other cases, we run it manually. Note, `false` only ignores\n * package scripts, the project postinstall is always trusted.\n */\n if (allowScripts !== true) {\n this.runProjectPostinstall(options);\n }\n } finally {\n this.reset();\n }\n }\n\n protected parseLockFile(): NpmLockFile | undefined {\n const lockFilePath = this.getLockFilePath();\n if (!lockFilePath) {\n return undefined;\n }\n try {\n return JSON.parse(fs.readFileSync(lockFilePath, 'utf-8'));\n } catch {\n return undefined;\n }\n }\n\n /**\n * Looks up a lockfile entry for the given workspace package, falling back\n * to the hoisted root entry. `workspacePackage` is the package's relative\n * path from the repo root; the empty string `''` denotes the root\n * workspace package itself, matching npm's own lockfile key convention.\n * Follows link entries to the resolved workspace package, so callers see\n * the workspace package's own metadata rather than the symlink stub.\n */\n private findEntry({\n workspacePackage,\n package: packageName,\n }: {\n workspacePackage: string | undefined;\n package: string;\n }): NpmLockFileEntry | undefined {\n if (workspacePackage === undefined) {\n return undefined;\n }\n const packages = this.getLockFile()?.packages;\n const entry =\n packages?.[`${workspacePackage}/node_modules/${packageName}`] ??\n packages?.[`node_modules/${packageName}`];\n if (entry?.link && entry.resolved) {\n return packages?.[entry.resolved];\n }\n return entry;\n }\n\n private runRebuild(scripts: string[]) {\n try {\n runCommand(this.command, ['rebuild', ...scripts], {\n stdio: ['inherit', 'inherit', 'pipe'],\n });\n } catch (error) {\n console.error(String(error));\n console.error(`Failed to run allowed scripts: ${scripts.join(', ')}`);\n process.exitCode = 1;\n }\n }\n\n private resolveMinReleaseAgeFlags(args: InstallArgs): string[] {\n if (args.fix) {\n return [];\n }\n\n const resolved = resolveMinReleaseAge(args.minReleaseAge);\n if (!resolved) {\n return [];\n }\n\n const version = runCommand(this.command, ['--version']).trim();\n if (versionCompare(version, MIN_NPM_VERSION_FOR_RELEASE_AGE) < 0) {\n console.warn(\n `WARNING: npm ${version} does not support minimum release age exclusions. Installing without minimum release age protection.`\n );\n return [];\n }\n\n const excludeFlags = resolved.exclude.map(\n pattern => `--min-release-age-exclude=${pattern}`\n );\n if (this.hasConfiguredMinReleaseAge()) {\n return [];\n }\n\n return [`--min-release-age=${resolved.days}`, ...excludeFlags];\n }\n\n private getMinReleaseAgeSettings(args: InstallArgs): string[] {\n const resolved = resolveMinReleaseAge(args.minReleaseAge);\n if (!resolved) {\n return [];\n }\n\n const version = runCommand(this.command, ['--version']).trim();\n if (versionCompare(version, MIN_NPM_VERSION_FOR_RELEASE_AGE) < 0) {\n return [];\n }\n\n const excludeSettings = resolved.exclude.map(\n pattern => `min-release-age-exclude=${pattern}`\n );\n return [`min-release-age=${resolved.days}`, ...excludeSettings];\n }\n\n private hasConfiguredMinReleaseAge(): boolean {\n try {\n const config = JSON.parse(runCommand(this.command, ['config', 'list', '--json']));\n return Number(config['min-release-age']) > 0;\n } catch {\n return false;\n }\n }\n\n private runProjectPostinstall(options?: Parameters<typeof runCommand>[2]) {\n try {\n runCommand(this.command, ['run', 'postinstall', '--if-present'], options);\n } catch {\n process.exitCode = 1;\n }\n }\n}\n"],"names":["NpmPackageManager","MIN_NPM_VERSION_FOR_RELEASE_AGE","PackageManager","clearCache","runCommand","command","getDeclaredVersion","workspacePackage","declaredBy","dependency","entry","findEntry","package","dependencies","peerDependencies","getRecommendedSettings","args","toNpmConfigSettings","getMinReleaseAgeSettings","getResolvedVersion","version","installPackages","options","builtInIgnoredScripts","AUDITED_SCRIPTS","filter","script","action","builtInAllowedScripts","usesStartup","builtInAllowlist","map","name","allowScripts","resolveAllowScripts","userAllowlist","Array","isArray","parseAllowScripts","minReleaseAgeFlags","resolveMinReleaseAgeFlags","quiet","logAllowedScripts","isCI","fix","trusted","filterTrustedScripts","getPackagesWithInstallScripts","error","console","String","process","exitCode","specs","length","withProjectAllowScripts","names","runRebuild","warnUntrustedInstallScripts","runProjectPostinstall","reset","parseLockFile","lockFilePath","getLockFilePath","undefined","JSON","parse","fs","readFileSync","packageName","packages","getLockFile","link","resolved","scripts","stdio","join","resolveMinReleaseAge","minReleaseAge","trim","versionCompare","warn","excludeFlags","exclude","pattern","hasConfiguredMinReleaseAge","days","excludeSettings","config","Number","lockFileName"],"mappings":"AAAA,6BAA6B;;;;+BA0ChBA;;;eAAAA;;;+DAzCE;uBASR;gCAEwB;wBAUxB;;;;;;;;;;;;;;;;;AAEP;;;CAGC,GACD,MAAMC,kCAAkC;AAcjC,MAAMD,0BAA0BE,8BAAc;IAIjDC,aAAa;QACTC,IAAAA,iBAAU,EAAC,IAAI,CAACC,OAAO,EAAE;YAAC;YAAS;YAAS;SAAU;IAC1D;IAEAC,mBAAmB,EACfC,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACS,EAAsB;;YAElCC,qBAAqCA;QAD5C,MAAMA,QAAQ,IAAI,CAACC,SAAS,CAAC;YAAEJ;YAAkBK,SAASJ;QAAW;QACrE,eAAOE,kBAAAA,6BAAAA,sBAAAA,MAAOG,YAAY,cAAnBH,0CAAAA,mBAAqB,CAACD,WAAW,uCAAIC,kBAAAA,6BAAAA,0BAAAA,MAAOI,gBAAgB,cAAvBJ,8CAAAA,uBAAyB,CAACD,WAAW;IACrF;IAEAM,uBAAuBC,IAAiB,EAAE;QACtC,OAAOC,IAAAA,0BAAmB,EAAC;YAAC;eAAgB,IAAI,CAACC,wBAAwB,CAACF;SAAM;IACpF;IAEAG,mBAAmB,EAAEZ,gBAAgB,EAAEE,UAAU,EAAwB,EAAsB;YACpF;QAAP,QAAO,kBAAA,IAAI,CAACE,SAAS,CAAC;YAAEJ;YAAkBK,SAASH;QAAW,gBAAvD,sCAAA,gBAA2DW,OAAO;IAC7E;IAEAC,gBAAgBL,OAAoB,CAAC,CAAC,EAAEM,OAA0C,EAAE;YAMvCN;QALzC,MAAMO,wBAAwBC,sBAAe,CAACC,MAAM,CAACC,CAAAA,SAAUA,OAAOC,MAAM,KAAK;QACjF,MAAMC,wBAAwBC,IAAAA,mBAAW,MACnCL,sBAAe,C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AO;YAAC,CAAC,gBAAgB,EAAEX,SAASa,IAAI,EAAE;eAAKC;SAAgB;IACnE;IAEQF,6BAAsC;QAC1C,IAAI;YACA,MAAMG,SAASvB,KAAKC,KAAK,CAAC9D,IAAAA,iBAAU,EAAC,IAAI,CAACC,OAAO,EAAE;gBAAC;gBAAU;gBAAQ;aAAS;YAC/E,OAAOoF,OAAOD,MAAM,CAAC,kBAAkB,IAAI;QAC/C,EAAE,eAAM;YACJ,OAAO;QACX;IACJ;IAEQ7B,sBAAsBrC,OAA0C,EAAE;QACtE,IAAI;YACAlB,IAAAA,iBAAU,EAAC,IAAI,CAACC,OAAO,EAAE;gBAAC;gBAAO;gBAAe;aAAe,EAAEiB;QACrE,EAAE,eAAM;YACJ6B,QAAQC,QAAQ,GAAG;QACvB;IACJ;;QAzNG,gBACH,uBAAS/C,WAAU,QACnB,uBAASqF,gBAAe;;AAwN5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { runCommand } from '../utils';
|
|
1
|
+
import { runCommand, Setting } from '../utils';
|
|
2
2
|
export type AllowScripts = true | false | string[];
|
|
3
3
|
export interface InstallArgs {
|
|
4
4
|
allowScripts?: AllowScripts;
|
|
@@ -7,12 +7,12 @@ export interface InstallArgs {
|
|
|
7
7
|
quiet?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export interface DeclaredVersionQuery {
|
|
10
|
-
workspacePackage: string;
|
|
10
|
+
workspacePackage: string | undefined;
|
|
11
11
|
declaredBy: string;
|
|
12
12
|
dependency: string;
|
|
13
13
|
}
|
|
14
14
|
export interface ResolvedVersionQuery {
|
|
15
|
-
workspacePackage: string;
|
|
15
|
+
workspacePackage: string | undefined;
|
|
16
16
|
dependency: string;
|
|
17
17
|
}
|
|
18
18
|
export declare abstract class PackageManager<LockFile = unknown> {
|
|
@@ -24,9 +24,12 @@ export declare abstract class PackageManager<LockFile = unknown> {
|
|
|
24
24
|
/**
|
|
25
25
|
* Returns the lockfile key for a package given its absolute or
|
|
26
26
|
* cwd-relative directory. Both npm and pnpm key their lockfile entries
|
|
27
|
-
* by the package's path relative to the workspace root.
|
|
27
|
+
* by the package's path relative to the workspace root. Returns undefined
|
|
28
|
+
* for a directory outside the lockfile's directory, which the lockfile
|
|
29
|
+
* doesn't describe.
|
|
28
30
|
*/
|
|
29
|
-
getWorkspacePackage(packageDir?: string): string;
|
|
31
|
+
getWorkspacePackage(packageDir?: string): string | undefined;
|
|
32
|
+
getRecommendedSettings(_args: InstallArgs): Setting[];
|
|
30
33
|
protected getLockFile(): LockFile | undefined;
|
|
31
34
|
protected reset(): void;
|
|
32
35
|
protected get rootWorkspacePackage(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../src/package-manager/package-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../src/package-manager/package-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,EAAE,CAAC;AAEnD,MAAM,WAAW,WAAW;IACxB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACjC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACjC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,8BAAsB,cAAc,CAAC,QAAQ,GAAG,OAAO;;IACnD,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAOvC,gBAAgB,IAAI,OAAO;IAI3B,eAAe,IAAI,MAAM,GAAG,SAAS;IAWrC;;;;;;OAMG;IACH,mBAAmB,CAAC,UAAU,SAAgB,GAAG,MAAM,GAAG,SAAS;IAiBnE,sBAAsB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,EAAE;IAIrD,SAAS,CAAC,WAAW,IAAI,QAAQ,GAAG,SAAS;IAQ7C,SAAS,CAAC,KAAK;IAOf,SAAS,KAAK,oBAAoB,IAAI,MAAM,CAE3C;IAED,QAAQ,CAAC,UAAU,IAAI,IAAI;IAC3B,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS;IAC5E,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS;IAC5E,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAE9F,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,QAAQ,GAAG,SAAS;CAC3D"}
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "PackageManager", {
|
|
|
8
8
|
return PackageManager;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
11
|
+
const _nodefs = /*#__PURE__*/ _interop_require_default(require("node:fs"));
|
|
12
12
|
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
13
13
|
const _utils = require("../utils");
|
|
14
14
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
@@ -60,7 +60,7 @@ class PackageManager {
|
|
|
60
60
|
if (!_class_private_field_get(this, _lockFilePathLoaded)) {
|
|
61
61
|
_class_private_field_set(this, _lockFilePath, (0, _utils.findUp)((directory)=>{
|
|
62
62
|
const candidate = _nodepath.default.join(directory, this.lockFileName);
|
|
63
|
-
return
|
|
63
|
+
return _nodefs.default.existsSync(candidate) ? candidate : undefined;
|
|
64
64
|
}));
|
|
65
65
|
_class_private_field_set(this, _lockFilePathLoaded, true);
|
|
66
66
|
}
|
|
@@ -69,14 +69,23 @@ class PackageManager {
|
|
|
69
69
|
/**
|
|
70
70
|
* Returns the lockfile key for a package given its absolute or
|
|
71
71
|
* cwd-relative directory. Both npm and pnpm key their lockfile entries
|
|
72
|
-
* by the package's path relative to the workspace root.
|
|
72
|
+
* by the package's path relative to the workspace root. Returns undefined
|
|
73
|
+
* for a directory outside the lockfile's directory, which the lockfile
|
|
74
|
+
* doesn't describe.
|
|
73
75
|
*/ getWorkspacePackage(packageDir = process.cwd()) {
|
|
74
76
|
const lockFilePath = this.getLockFilePath();
|
|
75
77
|
if (!lockFilePath) {
|
|
76
78
|
return this.rootWorkspacePackage;
|
|
77
79
|
}
|
|
78
|
-
const relative = _nodepath.default.relative(_nodepath.default.dirname(lockFilePath), _nodepath.default.resolve(packageDir))
|
|
79
|
-
|
|
80
|
+
const relative = _nodepath.default.relative(_nodepath.default.dirname(lockFilePath), _nodepath.default.resolve(packageDir));
|
|
81
|
+
if (relative === '..' || relative.startsWith(`..${_nodepath.default.sep}`) || // path.relative returns an absolute path for a directory on another Windows drive
|
|
82
|
+
_nodepath.default.isAbsolute(relative)) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
return relative === '' ? this.rootWorkspacePackage : relative.split(_nodepath.default.sep).join('/');
|
|
86
|
+
}
|
|
87
|
+
getRecommendedSettings(_args) {
|
|
88
|
+
return [];
|
|
80
89
|
}
|
|
81
90
|
getLockFile() {
|
|
82
91
|
if (!_class_private_field_get(this, _lockFileLoaded)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/package-manager/package-manager.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'node:path';\nimport { findUp, runCommand } from '../utils';\n\nexport type AllowScripts = true | false | string[];\n\nexport interface InstallArgs {\n allowScripts?: AllowScripts;\n fix?: boolean;\n minReleaseAge?: false;\n quiet?: boolean;\n}\n\nexport interface DeclaredVersionQuery {\n workspacePackage: string;\n declaredBy: string;\n dependency: string;\n}\n\nexport interface ResolvedVersionQuery {\n workspacePackage: string;\n dependency: string;\n}\n\nexport abstract class PackageManager<LockFile = unknown> {\n abstract readonly command: string;\n abstract readonly lockFileName: string;\n\n #lockFile: LockFile | undefined;\n #lockFileLoaded = false;\n #lockFilePath: string | undefined;\n #lockFilePathLoaded = false;\n\n hasValidLockFile(): boolean {\n return this.getLockFile() !== undefined;\n }\n\n getLockFilePath(): string | undefined {\n if (!this.#lockFilePathLoaded) {\n this.#lockFilePath = findUp(directory => {\n const candidate = path.join(directory, this.lockFileName);\n return fs.existsSync(candidate) ? candidate : undefined;\n });\n this.#lockFilePathLoaded = true;\n }\n return this.#lockFilePath;\n }\n\n /**\n * Returns the lockfile key for a package given its absolute or\n * cwd-relative directory. Both npm and pnpm key their lockfile entries\n * by the package's path relative to the workspace root.\n */\n getWorkspacePackage(packageDir = process.cwd()): string {\n const lockFilePath = this.getLockFilePath();\n if (!lockFilePath) {\n return this.rootWorkspacePackage;\n }\n const relative = path
|
|
1
|
+
{"version":3,"sources":["../../src/package-manager/package-manager.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { findUp, runCommand, Setting } from '../utils';\n\nexport type AllowScripts = true | false | string[];\n\nexport interface InstallArgs {\n allowScripts?: AllowScripts;\n fix?: boolean;\n minReleaseAge?: false;\n quiet?: boolean;\n}\n\nexport interface DeclaredVersionQuery {\n workspacePackage: string | undefined;\n declaredBy: string;\n dependency: string;\n}\n\nexport interface ResolvedVersionQuery {\n workspacePackage: string | undefined;\n dependency: string;\n}\n\nexport abstract class PackageManager<LockFile = unknown> {\n abstract readonly command: string;\n abstract readonly lockFileName: string;\n\n #lockFile: LockFile | undefined;\n #lockFileLoaded = false;\n #lockFilePath: string | undefined;\n #lockFilePathLoaded = false;\n\n hasValidLockFile(): boolean {\n return this.getLockFile() !== undefined;\n }\n\n getLockFilePath(): string | undefined {\n if (!this.#lockFilePathLoaded) {\n this.#lockFilePath = findUp(directory => {\n const candidate = path.join(directory, this.lockFileName);\n return fs.existsSync(candidate) ? candidate : undefined;\n });\n this.#lockFilePathLoaded = true;\n }\n return this.#lockFilePath;\n }\n\n /**\n * Returns the lockfile key for a package given its absolute or\n * cwd-relative directory. Both npm and pnpm key their lockfile entries\n * by the package's path relative to the workspace root. Returns undefined\n * for a directory outside the lockfile's directory, which the lockfile\n * doesn't describe.\n */\n getWorkspacePackage(packageDir = process.cwd()): string | undefined {\n const lockFilePath = this.getLockFilePath();\n if (!lockFilePath) {\n return this.rootWorkspacePackage;\n }\n const relative = path.relative(path.dirname(lockFilePath), path.resolve(packageDir));\n if (\n relative === '..' ||\n relative.startsWith(`..${path.sep}`) ||\n // path.relative returns an absolute path for a directory on another Windows drive\n path.isAbsolute(relative)\n ) {\n return undefined;\n }\n return relative === '' ? this.rootWorkspacePackage : relative.split(path.sep).join('/');\n }\n\n getRecommendedSettings(_args: InstallArgs): Setting[] {\n return [];\n }\n\n protected getLockFile(): LockFile | undefined {\n if (!this.#lockFileLoaded) {\n this.#lockFile = this.parseLockFile();\n this.#lockFileLoaded = true;\n }\n return this.#lockFile;\n }\n\n protected reset() {\n this.#lockFile = undefined;\n this.#lockFileLoaded = false;\n this.#lockFilePath = undefined;\n this.#lockFilePathLoaded = false;\n }\n\n protected get rootWorkspacePackage(): string {\n return '';\n }\n\n abstract clearCache(): void;\n abstract getDeclaredVersion(query: DeclaredVersionQuery): string | undefined;\n abstract getResolvedVersion(query: ResolvedVersionQuery): string | undefined;\n abstract installPackages(args?: InstallArgs, options?: Parameters<typeof runCommand>[2]): void;\n\n protected abstract parseLockFile(): LockFile | undefined;\n}\n"],"names":["PackageManager","hasValidLockFile","getLockFile","undefined","getLockFilePath","findUp","directory","candidate","path","join","lockFileName","fs","existsSync","getWorkspacePackage","packageDir","process","cwd","lockFilePath","rootWorkspacePackage","relative","dirname","resolve","startsWith","sep","isAbsolute","split","getRecommendedSettings","_args","parseLockFile","reset"],"mappings":";;;;+BAwBsBA;;;eAAAA;;;+DAxBP;iEACE;uBAC2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BxC,yCACA,+CACA,6CACA;AAPG,MAAeA;IASlBC,mBAA4B;QACxB,OAAO,IAAI,CAACC,WAAW,OAAOC;IAClC;IAEAC,kBAAsC;QAClC,IAAI,0BAAC,IAAI,EAAC,sBAAqB;2CACtB,eAAgBC,IAAAA,aAAM,EAACC,CAAAA;gBACxB,MAAMC,YAAYC,iBAAI,CAACC,IAAI,CAACH,WAAW,IAAI,CAACI,YAAY;gBACxD,OAAOC,eAAE,CAACC,UAAU,CAACL,aAAaA,YAAYJ;YAClD;2CACK,qBAAsB;QAC/B;QACA,gCAAO,IAAI,EAAC;IAChB;IAEA;;;;;;KAMC,GACDU,oBAAoBC,aAAaC,QAAQC,GAAG,EAAE,EAAsB;QAChE,MAAMC,eAAe,IAAI,CAACb,eAAe;QACzC,IAAI,CAACa,cAAc;YACf,OAAO,IAAI,CAACC,oBAAoB;QACpC;QACA,MAAMC,WAAWX,iBAAI,CAACW,QAAQ,CAACX,iBAAI,CAACY,OAAO,CAACH,eAAeT,iBAAI,CAACa,OAAO,CAACP;QACxE,IACIK,aAAa,QACbA,SAASG,UAAU,CAAC,CAAC,EAAE,EAAEd,iBAAI,CAACe,GAAG,EAAE,KACnC,kFAAkF;QAClFf,iBAAI,CAACgB,UAAU,CAACL,WAClB;YACE,OAAOhB;QACX;QACA,OAAOgB,aAAa,KAAK,IAAI,CAACD,oBAAoB,GAAGC,SAASM,KAAK,CAACjB,iBAAI,CAACe,GAAG,EAAEd,IAAI,CAAC;IACvF;IAEAiB,uBAAuBC,KAAkB,EAAa;QAClD,OAAO,EAAE;IACb;IAEUzB,cAAoC;QAC1C,IAAI,0BAAC,IAAI,EAAC,kBAAiB;2CAClB,WAAY,IAAI,CAAC0B,aAAa;2CAC9B,iBAAkB;QAC3B;QACA,gCAAO,IAAI,EAAC;IAChB;IAEUC,QAAQ;uCACT,WAAY1B;uCACZ,iBAAkB;uCAClB,eAAgBA;uCAChB,qBAAsB;IAC/B;IAEA,IAAce,uBAA+B;QACzC,OAAO;IACX;;QAjEA,gCAAA;;mBAAA,KAAA;;QACA,gCAAA;;mBAAkB;;QAClB,gCAAA;;mBAAA,KAAA;;QACA,gCAAA;;mBAAsB;;;AAsE1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { runCommand } from '../utils';
|
|
1
|
+
import { runCommand, Setting } from '../utils';
|
|
2
2
|
import type { DeclaredVersionQuery, InstallArgs, ResolvedVersionQuery } from './package-manager';
|
|
3
3
|
import { PackageManager } from './package-manager';
|
|
4
4
|
interface PnpmImporterEntry {
|
|
@@ -24,9 +24,17 @@ export declare class PnpmPackageManager extends PackageManager<PnpmLockFile> {
|
|
|
24
24
|
protected get rootWorkspacePackage(): string;
|
|
25
25
|
clearCache(): void;
|
|
26
26
|
getDeclaredVersion({ workspacePackage, declaredBy, dependency, }: DeclaredVersionQuery): string | undefined;
|
|
27
|
+
getRecommendedSettings(args: InstallArgs): Setting[];
|
|
27
28
|
getResolvedVersion({ workspacePackage, dependency }: ResolvedVersionQuery): string | undefined;
|
|
28
29
|
installPackages(args?: InstallArgs, options?: Parameters<typeof runCommand>[2]): void;
|
|
29
30
|
protected parseLockFile(): PnpmLockFile | undefined;
|
|
31
|
+
private getMinReleaseAgeSettings;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the version of a dependency that a workspace package resolves to. When the package
|
|
34
|
+
* doesn't declare the dependency itself, it resolves through the root's node_modules, so this
|
|
35
|
+
* falls back to the root workspace's dependencies. Packages outside the workspace get no
|
|
36
|
+
* fallback.
|
|
37
|
+
*/
|
|
30
38
|
private resolveVersion;
|
|
31
39
|
private warnIfMinReleaseAgeNotConfigured;
|
|
32
40
|
private hasConfiguredMinReleaseAge;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pnpm-package-manager.d.ts","sourceRoot":"","sources":["../../src/package-manager/pnpm-package-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pnpm-package-manager.d.ts","sourceRoot":"","sources":["../../src/package-manager/pnpm-package-manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAKH,UAAU,EACV,OAAO,EAGV,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMnD,UAAU,iBAAiB;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,YAAY;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACpD,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC5D;AAED,UAAU,YAAY;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,YAAY;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC5C;AAED,qBAAa,kBAAmB,SAAQ,cAAc,CAAC,YAAY,CAAC;IAChE,QAAQ,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