@servicetitan/install 36.3.1 → 36.4.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/package-manager/npm-package-manager.d.ts.map +1 -1
- package/dist/package-manager/npm-package-manager.js +3 -8
- package/dist/package-manager/npm-package-manager.js.map +1 -1
- package/dist/package-manager/package-manager.d.ts +1 -1
- package/dist/package-manager/package-manager.d.ts.map +1 -1
- package/dist/package-manager/package-manager.js +23 -9
- package/dist/package-manager/package-manager.js.map +1 -1
- package/dist/package-manager/pnpm-package-manager.js +1 -1
- package/dist/package-manager/pnpm-package-manager.js.map +1 -1
- package/dist/utils/get-packages-with-install-scripts.d.ts.map +1 -1
- package/dist/utils/get-packages-with-install-scripts.js +6 -2
- package/dist/utils/get-packages-with-install-scripts.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/warn-untrusted-install-scripts.d.ts +1 -5
- package/dist/utils/warn-untrusted-install-scripts.d.ts.map +1 -1
- package/dist/utils/warn-untrusted-install-scripts.js +1 -6
- package/dist/utils/warn-untrusted-install-scripts.js.map +1 -1
- package/package.json +3 -3
- package/src/package-manager/npm-package-manager.ts +3 -9
- package/src/package-manager/package-manager.ts +17 -9
- package/src/package-manager/pnpm-package-manager.ts +1 -1
- package/src/utils/get-packages-with-install-scripts.ts +7 -2
- package/src/utils/index.ts +0 -1
- package/src/utils/warn-untrusted-install-scripts.ts +1 -15
- package/dist/utils/has-lockfile-changed.d.ts +0 -2
- package/dist/utils/has-lockfile-changed.d.ts.map +0 -1
- package/dist/utils/has-lockfile-changed.js +0 -27
- package/dist/utils/has-lockfile-changed.js.map +0 -1
- package/src/utils/has-lockfile-changed.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm-package-manager.d.ts","sourceRoot":"","sources":["../../src/package-manager/npm-package-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,UAAU,EAA+B,MAAM,UAAU,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQnD,UAAU,gBAAgB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,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,WAAW;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC/C;AAED,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC9D,QAAQ,CAAC,OAAO,SAAS;IACzB,QAAQ,CAAC,YAAY,uBAAuB;IAE5C,UAAU;IAIV,kBAAkB,CAAC,EACf,gBAAgB,EAChB,UAAU,EACV,UAAU,GACb,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS;IAK5C,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS;IAI9F,eAAe,CAAC,IAAI,GAAE,WAAgB,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"npm-package-manager.d.ts","sourceRoot":"","sources":["../../src/package-manager/npm-package-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,UAAU,EAA+B,MAAM,UAAU,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQnD,UAAU,gBAAgB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,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,WAAW;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC/C;AAED,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,WAAW,CAAC;IAC9D,QAAQ,CAAC,OAAO,SAAS;IACzB,QAAQ,CAAC,YAAY,uBAAuB;IAE5C,UAAU;IAIV,kBAAkB,CAAC,EACf,gBAAgB,EAChB,UAAU,EACV,UAAU,GACb,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS;IAK5C,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,EAAE,oBAAoB,GAAG,MAAM,GAAG,SAAS;IAI9F,eAAe,CAAC,IAAI,GAAE,WAAgB,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;IAuDlF,SAAS,CAAC,aAAa,IAAI,WAAW,GAAG,SAAS;IAYlD;;;;;;;OAOG;IACH,OAAO,CAAC,SAAS;IAiBjB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,qBAAqB;CAOhC"}
|
|
@@ -56,10 +56,7 @@ class NpmPackageManager extends _packagemanager.PackageManager {
|
|
|
56
56
|
}
|
|
57
57
|
installPackages(args = {}, options) {
|
|
58
58
|
var _args_allowScripts;
|
|
59
|
-
|
|
60
|
-
* The `true` fallback allows projects a grace period to identify and
|
|
61
|
-
* allowlist trusted scripts. Remove the fallback when the grace period expires.
|
|
62
|
-
*/ const allowScripts = (0, _utils1.resolveAllowScripts)((_args_allowScripts = args.allowScripts) !== null && _args_allowScripts !== void 0 ? _args_allowScripts : true);
|
|
59
|
+
const allowScripts = (0, _utils1.resolveAllowScripts)((_args_allowScripts = args.allowScripts) !== null && _args_allowScripts !== void 0 ? _args_allowScripts : []);
|
|
63
60
|
if (!args.quiet) {
|
|
64
61
|
(0, _utils1.logAllowedScripts)(allowScripts);
|
|
65
62
|
}
|
|
@@ -92,9 +89,7 @@ class NpmPackageManager extends _packagemanager.PackageManager {
|
|
|
92
89
|
* scripts they should add to --allow-scripts. Skip when the user
|
|
93
90
|
* explicitly opted out (`false`); they made an informed choice.
|
|
94
91
|
*/ if (allowScripts !== false) {
|
|
95
|
-
(0, _utils.warnUntrustedInstallScripts)(Array.isArray(allowScripts) ? allowScripts : _utils1.DEFAULT_ALLOWED_SCRIPTS
|
|
96
|
-
force: true
|
|
97
|
-
});
|
|
92
|
+
(0, _utils.warnUntrustedInstallScripts)(Array.isArray(allowScripts) ? allowScripts : _utils1.DEFAULT_ALLOWED_SCRIPTS);
|
|
98
93
|
}
|
|
99
94
|
/*
|
|
100
95
|
* When allowScripts is `true`, npm already ran project postinstall.
|
|
@@ -108,7 +103,7 @@ class NpmPackageManager extends _packagemanager.PackageManager {
|
|
|
108
103
|
}
|
|
109
104
|
}
|
|
110
105
|
parseLockFile() {
|
|
111
|
-
const lockFilePath = this.
|
|
106
|
+
const lockFilePath = this.getLockFilePath();
|
|
112
107
|
if (!lockFilePath) {
|
|
113
108
|
return undefined;
|
|
114
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/package-manager/npm-package-manager.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'fs';\nimport { isCI, runCommand, warnUntrustedInstallScripts } from '../utils';\nimport type { DeclaredVersionQuery, InstallArgs, ResolvedVersionQuery } from './package-manager';\nimport { PackageManager } from './package-manager';\nimport {\n DEFAULT_ALLOWED_SCRIPTS,\n logAllowedScripts,\n resolveAllowScripts,\n shouldIgnoreScripts,\n} from './utils';\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
|
|
1
|
+
{"version":3,"sources":["../../src/package-manager/npm-package-manager.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'fs';\nimport { isCI, runCommand, warnUntrustedInstallScripts } from '../utils';\nimport type { DeclaredVersionQuery, InstallArgs, ResolvedVersionQuery } from './package-manager';\nimport { PackageManager } from './package-manager';\nimport {\n DEFAULT_ALLOWED_SCRIPTS,\n logAllowedScripts,\n resolveAllowScripts,\n shouldIgnoreScripts,\n} from './utils';\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 allowScripts = resolveAllowScripts(args.allowScripts ?? []);\n\n if (!args.quiet) {\n logAllowedScripts(allowScripts);\n }\n\n runCommand(\n this.command,\n [\n isCI() ? 'ci' : 'i',\n '--audit=false',\n '--fund=false',\n '--legacy-peer-deps',\n ...(shouldIgnoreScripts(allowScripts) ? ['--ignore-scripts'] : []),\n ...(args.fix ? ['--package-lock-only', '--prefer-dedupe'] : []),\n ],\n options\n );\n\n try {\n if (args.fix) {\n return;\n }\n /*\n * Rebuild applies when allowScripts is an explicit list:\n * `true` means npm install already ran every script, `false`\n * means the user opted out.\n */\n if (Array.isArray(allowScripts)) {\n this.runRebuild(allowScripts);\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 Array.isArray(allowScripts) ? allowScripts : DEFAULT_ALLOWED_SCRIPTS\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 } catch {\n console.error(`Failed to run allowed scripts: ${scripts.join(', ')}`);\n process.exitCode = 1;\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","PackageManager","clearCache","runCommand","command","getDeclaredVersion","workspacePackage","declaredBy","dependency","entry","findEntry","package","dependencies","peerDependencies","getResolvedVersion","version","installPackages","args","options","allowScripts","resolveAllowScripts","quiet","logAllowedScripts","isCI","shouldIgnoreScripts","fix","Array","isArray","runRebuild","warnUntrustedInstallScripts","DEFAULT_ALLOWED_SCRIPTS","runProjectPostinstall","reset","parseLockFile","lockFilePath","getLockFilePath","undefined","JSON","parse","fs","readFileSync","packageName","packages","getLockFile","link","resolved","scripts","console","error","join","process","exitCode","lockFileName"],"mappings":"AAAA,6BAA6B;;;;+BAwBhBA;;;eAAAA;;;2DAvBE;uBAC+C;gCAE/B;wBAMxB;;;;;;;;;;;;;;;;;;;AAcA,MAAMA,0BAA0BC,8BAAc;IAIjDC,aAAa;QACTC,IAAAA,iBAAU,EAAC,IAAI,CAACC,OAAO,EAAE;YAAC;YAAS;YAAS;SAAU;IAC1D;IAEAC,mBAAmB,EACfC,gBAAgB,EAChBC,UAA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ACJgC,QAAQC,QAAQ,GAAG;QACvB;IACJ;;QAhIG,gBACH,uBAAS/C,WAAU,QACnB,uBAASgD,gBAAe;;AA+H5B"}
|
|
@@ -19,6 +19,7 @@ export declare abstract class PackageManager<LockFile = unknown> {
|
|
|
19
19
|
abstract readonly command: string;
|
|
20
20
|
abstract readonly lockFileName: string;
|
|
21
21
|
hasValidLockFile(): boolean;
|
|
22
|
+
getLockFilePath(): string | undefined;
|
|
22
23
|
/**
|
|
23
24
|
* Returns the lockfile key for a package given its absolute or
|
|
24
25
|
* cwd-relative directory. Both npm and pnpm key their lockfile entries
|
|
@@ -27,7 +28,6 @@ export declare abstract class PackageManager<LockFile = unknown> {
|
|
|
27
28
|
getWorkspacePackage(packageDir?: string): string;
|
|
28
29
|
protected getLockFile(): LockFile | undefined;
|
|
29
30
|
protected reset(): void;
|
|
30
|
-
protected findLockFilePath(): string | undefined;
|
|
31
31
|
protected get rootWorkspacePackage(): string;
|
|
32
32
|
abstract clearCache(): void;
|
|
33
33
|
abstract getDeclaredVersion(query: DeclaredVersionQuery): string | undefined;
|
|
@@ -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;AAE9C,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,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,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K,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 _fs = /*#__PURE__*/ _interop_require_default(require("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) {
|
|
@@ -56,17 +56,27 @@ function _interop_require_default(obj) {
|
|
|
56
56
|
default: obj
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
var _lockFile = /*#__PURE__*/ new WeakMap(), _lockFileLoaded = /*#__PURE__*/ new WeakMap();
|
|
59
|
+
var _lockFile = /*#__PURE__*/ new WeakMap(), _lockFileLoaded = /*#__PURE__*/ new WeakMap(), _lockFilePath = /*#__PURE__*/ new WeakMap(), _lockFilePathLoaded = /*#__PURE__*/ new WeakMap();
|
|
60
60
|
class PackageManager {
|
|
61
61
|
hasValidLockFile() {
|
|
62
62
|
return this.getLockFile() !== undefined;
|
|
63
63
|
}
|
|
64
|
+
getLockFilePath() {
|
|
65
|
+
if (!_class_private_field_get(this, _lockFilePathLoaded)) {
|
|
66
|
+
_class_private_field_set(this, _lockFilePath, (0, _utils.findUp)((directory)=>{
|
|
67
|
+
const candidate = _nodepath.default.join(directory, this.lockFileName);
|
|
68
|
+
return _fs.default.existsSync(candidate) ? candidate : undefined;
|
|
69
|
+
}));
|
|
70
|
+
_class_private_field_set(this, _lockFilePathLoaded, true);
|
|
71
|
+
}
|
|
72
|
+
return _class_private_field_get(this, _lockFilePath);
|
|
73
|
+
}
|
|
64
74
|
/**
|
|
65
75
|
* Returns the lockfile key for a package given its absolute or
|
|
66
76
|
* cwd-relative directory. Both npm and pnpm key their lockfile entries
|
|
67
77
|
* by the package's path relative to the workspace root.
|
|
68
78
|
*/ getWorkspacePackage(packageDir = process.cwd()) {
|
|
69
|
-
const lockFilePath = this.
|
|
79
|
+
const lockFilePath = this.getLockFilePath();
|
|
70
80
|
if (!lockFilePath) {
|
|
71
81
|
return this.rootWorkspacePackage;
|
|
72
82
|
}
|
|
@@ -83,12 +93,8 @@ class PackageManager {
|
|
|
83
93
|
reset() {
|
|
84
94
|
_class_private_field_set(this, _lockFile, undefined);
|
|
85
95
|
_class_private_field_set(this, _lockFileLoaded, false);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return (0, _utils.findUp)((directory)=>{
|
|
89
|
-
const candidate = _nodepath.default.join(directory, this.lockFileName);
|
|
90
|
-
return _nodefs.default.existsSync(candidate) ? candidate : undefined;
|
|
91
|
-
});
|
|
96
|
+
_class_private_field_set(this, _lockFilePath, undefined);
|
|
97
|
+
_class_private_field_set(this, _lockFilePathLoaded, false);
|
|
92
98
|
}
|
|
93
99
|
get rootWorkspacePackage() {
|
|
94
100
|
return '';
|
|
@@ -102,6 +108,14 @@ class PackageManager {
|
|
|
102
108
|
writable: true,
|
|
103
109
|
value: false
|
|
104
110
|
});
|
|
111
|
+
_class_private_field_init(this, _lockFilePath, {
|
|
112
|
+
writable: true,
|
|
113
|
+
value: void 0
|
|
114
|
+
});
|
|
115
|
+
_class_private_field_init(this, _lockFilePathLoaded, {
|
|
116
|
+
writable: true,
|
|
117
|
+
value: false
|
|
118
|
+
});
|
|
105
119
|
}
|
|
106
120
|
}
|
|
107
121
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/package-manager/package-manager.ts"],"sourcesContent":["import fs from '
|
|
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 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\n .relative(path.dirname(lockFilePath), path.resolve(packageDir))\n .split(path.sep)\n .join('/');\n return relative === '' ? this.rootWorkspacePackage : relative;\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","split","sep","parseLockFile","reset"],"mappings":";;;;+BAuBsBA;;;eAAAA;;;2DAvBP;iEACE;uBACkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyB/B,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,WAAE,CAACC,UAAU,CAACL,aAAaA,YAAYJ;YAClD;2CACK,qBAAsB;QAC/B;QACA,gCAAO,IAAI,EAAC;IAChB;IAEA;;;;KAIC,GACDU,oBAAoBC,aAAaC,QAAQC,GAAG,EAAE,EAAU;QACpD,MAAMC,eAAe,IAAI,CAACb,eAAe;QACzC,IAAI,CAACa,cAAc;YACf,OAAO,IAAI,CAACC,oBAAoB;QACpC;QACA,MAAMC,WAAWX,iBAAI,CAChBW,QAAQ,CAACX,iBAAI,CAACY,OAAO,CAACH,eAAeT,iBAAI,CAACa,OAAO,CAACP,aAClDQ,KAAK,CAACd,iBAAI,CAACe,GAAG,EACdd,IAAI,CAAC;QACV,OAAOU,aAAa,KAAK,IAAI,CAACD,oBAAoB,GAAGC;IACzD;IAEUjB,cAAoC;QAC1C,IAAI,0BAAC,IAAI,EAAC,kBAAiB;2CAClB,WAAY,IAAI,CAACsB,aAAa;2CAC9B,iBAAkB;QAC3B;QACA,gCAAO,IAAI,EAAC;IAChB;IAEUC,QAAQ;uCACT,WAAYtB;uCACZ,iBAAkB;uCAClB,eAAgBA;uCAChB,qBAAsB;IAC/B;IAEA,IAAce,uBAA+B;QACzC,OAAO;IACX;;QAtDA,gCAAA;;mBAAA,KAAA;;QACA,gCAAA;;mBAAkB;;QAClB,gCAAA;;mBAAA,KAAA;;QACA,gCAAA;;mBAAsB;;;AA2D1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/package-manager/pnpm-package-manager.ts"],"sourcesContent":["import fs from 'fs';\nimport { isCI, runCommand } from '../utils';\nimport type { DeclaredVersionQuery, InstallArgs, ResolvedVersionQuery } from './package-manager';\nimport { PackageManager } from './package-manager';\n\ninterface PnpmImporterEntry {\n specifier: string;\n version: string;\n}\n\ninterface PnpmImporter {\n dependencies?: Record<string, PnpmImporterEntry>;\n devDependencies?: Record<string, PnpmImporterEntry>;\n optionalDependencies?: Record<string, PnpmImporterEntry>;\n}\n\ninterface PnpmSnapshot {\n dependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\nexport interface PnpmLockFile {\n importers?: Record<string, PnpmImporter>;\n snapshots?: Record<string, PnpmSnapshot>;\n}\n\nexport class PnpmPackageManager extends PackageManager<PnpmLockFile> {\n readonly command = 'pnpm';\n readonly lockFileName = 'pnpm-lock.yaml';\n\n protected override get rootWorkspacePackage(): string {\n return '.';\n }\n\n clearCache() {\n runCommand(this.command, ['store', 'prune']);\n }\n\n getDeclaredVersion({\n workspacePackage,\n declaredBy,\n dependency,\n }: DeclaredVersionQuery): string | undefined {\n const declaredByVersion = this.resolveVersion(workspacePackage, declaredBy);\n if (!declaredByVersion) {\n return undefined;\n }\n const snapshot = this.getLockFile()?.snapshots?.[`${declaredBy}@${declaredByVersion}`];\n return snapshot?.dependencies?.[dependency] ?? snapshot?.peerDependencies?.[dependency];\n }\n\n getResolvedVersion({ workspacePackage, dependency }: ResolvedVersionQuery): string | undefined {\n return this.resolveVersion(workspacePackage, dependency);\n }\n\n installPackages(args: InstallArgs = {}, options?: Parameters<typeof runCommand>[2]) {\n try {\n runCommand(\n this.command,\n [\n 'install',\n ...(isCI() ? ['--frozen-lockfile'] : []),\n ...(args.fix ? ['--lockfile-only'] : []),\n ],\n options\n );\n } finally {\n this.reset();\n }\n }\n\n protected parseLockFile(): PnpmLockFile | undefined {\n const lockFilePath = this.
|
|
1
|
+
{"version":3,"sources":["../../src/package-manager/pnpm-package-manager.ts"],"sourcesContent":["import fs from 'fs';\nimport { isCI, runCommand } from '../utils';\nimport type { DeclaredVersionQuery, InstallArgs, ResolvedVersionQuery } from './package-manager';\nimport { PackageManager } from './package-manager';\n\ninterface PnpmImporterEntry {\n specifier: string;\n version: string;\n}\n\ninterface PnpmImporter {\n dependencies?: Record<string, PnpmImporterEntry>;\n devDependencies?: Record<string, PnpmImporterEntry>;\n optionalDependencies?: Record<string, PnpmImporterEntry>;\n}\n\ninterface PnpmSnapshot {\n dependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n}\n\nexport interface PnpmLockFile {\n importers?: Record<string, PnpmImporter>;\n snapshots?: Record<string, PnpmSnapshot>;\n}\n\nexport class PnpmPackageManager extends PackageManager<PnpmLockFile> {\n readonly command = 'pnpm';\n readonly lockFileName = 'pnpm-lock.yaml';\n\n protected override get rootWorkspacePackage(): string {\n return '.';\n }\n\n clearCache() {\n runCommand(this.command, ['store', 'prune']);\n }\n\n getDeclaredVersion({\n workspacePackage,\n declaredBy,\n dependency,\n }: DeclaredVersionQuery): string | undefined {\n const declaredByVersion = this.resolveVersion(workspacePackage, declaredBy);\n if (!declaredByVersion) {\n return undefined;\n }\n const snapshot = this.getLockFile()?.snapshots?.[`${declaredBy}@${declaredByVersion}`];\n return snapshot?.dependencies?.[dependency] ?? snapshot?.peerDependencies?.[dependency];\n }\n\n getResolvedVersion({ workspacePackage, dependency }: ResolvedVersionQuery): string | undefined {\n return this.resolveVersion(workspacePackage, dependency);\n }\n\n installPackages(args: InstallArgs = {}, options?: Parameters<typeof runCommand>[2]) {\n try {\n runCommand(\n this.command,\n [\n 'install',\n ...(isCI() ? ['--frozen-lockfile'] : []),\n ...(args.fix ? ['--lockfile-only'] : []),\n ],\n options\n );\n } finally {\n this.reset();\n }\n }\n\n protected parseLockFile(): PnpmLockFile | undefined {\n const lockFilePath = this.getLockFilePath();\n if (!lockFilePath) {\n return undefined;\n }\n /*\n * js-yaml is an optional peer; let MODULE_NOT_FOUND surface so a caller\n * missing the dep gets a clear error instead of silent `undefined`.\n */\n const yaml = require('js-yaml');\n try {\n return yaml.load(fs.readFileSync(lockFilePath, 'utf-8'));\n } catch {\n return undefined;\n }\n }\n\n private resolveVersion(workspacePackage: string, dependency: string): string | undefined {\n const importer = this.getLockFile()?.importers?.[workspacePackage];\n const entry =\n importer?.dependencies?.[dependency] ??\n importer?.devDependencies?.[dependency] ??\n importer?.optionalDependencies?.[dependency];\n return entry ? stripPeerDependencySuffix(entry.version) : undefined;\n }\n}\n\nfunction stripPeerDependencySuffix(version: string): string {\n // e.g., \"1.2.3(react@18.2.0)(react-dom@18.2.0)\" → \"1.2.3\"\n return version.split('(')[0];\n}\n"],"names":["PnpmPackageManager","PackageManager","rootWorkspacePackage","clearCache","runCommand","command","getDeclaredVersion","workspacePackage","declaredBy","dependency","snapshot","declaredByVersion","resolveVersion","undefined","getLockFile","snapshots","dependencies","peerDependencies","getResolvedVersion","installPackages","args","options","isCI","fix","reset","parseLockFile","lockFilePath","getLockFilePath","yaml","require","load","fs","readFileSync","importer","importers","entry","devDependencies","optionalDependencies","stripPeerDependencySuffix","version","lockFileName","split"],"mappings":";;;;+BA0BaA;;;eAAAA;;;2DA1BE;uBACkB;gCAEF;;;;;;;;;;;;;;;;;;;AAuBxB,MAAMA,2BAA2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,OAAOD,KAAKE,IAAI,CAACC,WAAE,CAACC,YAAY,CAACN,cAAc;QACnD,EAAE,eAAM;YACJ,OAAOb;QACX;IACJ;IAEQD,eAAeL,gBAAwB,EAAEE,UAAkB,EAAsB;YAGjFwB;YAFa,6BAAA,mBAEbA,wBACAA,2BACAA;QAJJ,MAAMA,YAAW,oBAAA,IAAI,CAACnB,WAAW,gBAAhB,yCAAA,8BAAA,kBAAoBoB,SAAS,cAA7B,kDAAA,2BAA+B,CAAC3B,iBAAiB;QAClE,MAAM4B,SACFF,gBAAAA,qBAAAA,gCAAAA,yBAAAA,SAAUjB,YAAY,cAAtBiB,6CAAAA,sBAAwB,CAACxB,WAAW,yCACpCwB,qBAAAA,gCAAAA,4BAAAA,SAAUG,eAAe,cAAzBH,gDAAAA,yBAA2B,CAACxB,WAAW,cADvCwB,kBAAAA,OAEAA,qBAAAA,gCAAAA,iCAAAA,SAAUI,oBAAoB,cAA9BJ,qDAAAA,8BAAgC,CAACxB,WAAW;QAChD,OAAO0B,QAAQG,0BAA0BH,MAAMI,OAAO,IAAI1B;IAC9D;;QArEG,gBACH,uBAASR,WAAU,SACnB,uBAASmC,gBAAe;;AAoE5B;AAEA,SAASF,0BAA0BC,OAAe;IAC9C,0DAA0D;IAC1D,OAAOA,QAAQE,KAAK,CAAC,IAAI,CAAC,EAAE;AAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-packages-with-install-scripts.d.ts","sourceRoot":"","sources":["../../src/utils/get-packages-with-install-scripts.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"get-packages-with-install-scripts.d.ts","sourceRoot":"","sources":["../../src/utils/get-packages-with-install-scripts.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAWD,wBAAgB,6BAA6B,IAAI,iBAAiB,EAAE,CAWnE"}
|
|
@@ -9,11 +9,15 @@ Object.defineProperty(exports, "getPackagesWithInstallScripts", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _os = require("./os");
|
|
12
|
-
|
|
12
|
+
/*
|
|
13
|
+
* Keep this selector free of whitespace. On Windows npm runs through a shell (npm.CMD) and
|
|
14
|
+
* execFileSync passes args unquoted, so a space would split the selector at the shell and npm
|
|
15
|
+
* query would receive a truncated, invalid selector.
|
|
16
|
+
*/ const SELECTORS = [
|
|
13
17
|
'preinstall',
|
|
14
18
|
'install',
|
|
15
19
|
'postinstall'
|
|
16
|
-
].map((script)=>`:attr(scripts,
|
|
20
|
+
].map((script)=>`:attr(scripts,[${script}])`).join(',');
|
|
17
21
|
function getPackagesWithInstallScripts() {
|
|
18
22
|
try {
|
|
19
23
|
const result = (0, _os.runCommand)('npm', [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/get-packages-with-install-scripts.ts"],"sourcesContent":["import { runCommand } from './os';\n\ninterface PackageWithScript {\n location: string;\n name: string;\n version: string;\n}\n\nconst SELECTORS = ['preinstall', 'install', 'postinstall']\n .map(script => `:attr(scripts,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/get-packages-with-install-scripts.ts"],"sourcesContent":["import { runCommand } from './os';\n\ninterface PackageWithScript {\n location: string;\n name: string;\n version: string;\n}\n\n/*\n * Keep this selector free of whitespace. On Windows npm runs through a shell (npm.CMD) and\n * execFileSync passes args unquoted, so a space would split the selector at the shell and npm\n * query would receive a truncated, invalid selector.\n */\nconst SELECTORS = ['preinstall', 'install', 'postinstall']\n .map(script => `:attr(scripts,[${script}])`)\n .join(',');\n\nexport function getPackagesWithInstallScripts(): PackageWithScript[] {\n try {\n const result = runCommand('npm', ['query', SELECTORS, '--json']);\n return JSON.parse(result).map(({ location, name, version }: PackageWithScript) => ({\n location,\n name,\n version,\n }));\n } catch {\n return [];\n }\n}\n"],"names":["getPackagesWithInstallScripts","SELECTORS","map","script","join","result","runCommand","JSON","parse","location","name","version"],"mappings":";;;;+BAiBgBA;;;eAAAA;;;oBAjBW;AAQ3B;;;;CAIC,GACD,MAAMC,YAAY;IAAC;IAAc;IAAW;CAAc,CACrDC,GAAG,CAACC,CAAAA,SAAU,CAAC,eAAe,EAAEA,OAAO,EAAE,CAAC,EAC1CC,IAAI,CAAC;AAEH,SAASJ;IACZ,IAAI;QACA,MAAMK,SAASC,IAAAA,cAAU,EAAC,OAAO;YAAC;YAASL;YAAW;SAAS;QAC/D,OAAOM,KAAKC,KAAK,CAACH,QAAQH,GAAG,CAAC,CAAC,EAAEO,QAAQ,EAAEC,IAAI,EAAEC,OAAO,EAAqB,GAAM,CAAA;gBAC/EF;gBACAC;gBACAC;YACJ,CAAA;IACJ,EAAE,eAAM;QACJ,OAAO,EAAE;IACb;AACJ"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,qCAAqC,CAAC;AACpD,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,kCAAkC,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -8,7 +8,6 @@ _export_star(require("./find-up"), exports);
|
|
|
8
8
|
_export_star(require("./get-packages-with-install-scripts"), exports);
|
|
9
9
|
_export_star(require("./get-version"), exports);
|
|
10
10
|
_export_star(require("./git"), exports);
|
|
11
|
-
_export_star(require("./has-lockfile-changed"), exports);
|
|
12
11
|
_export_star(require("./npm"), exports);
|
|
13
12
|
_export_star(require("./os"), exports);
|
|
14
13
|
_export_star(require("./read-json"), exports);
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './ci';\nexport * from './debug';\nexport * from './find-up';\nexport * from './get-packages-with-install-scripts';\nexport * from './get-version';\nexport * from './git';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './ci';\nexport * from './debug';\nexport * from './find-up';\nexport * from './get-packages-with-install-scripts';\nexport * from './get-version';\nexport * from './git';\nexport * from './npm';\nexport * from './os';\nexport * from './read-json';\nexport * from './warn-untrusted-install-scripts';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
force?: boolean;
|
|
3
|
-
}
|
|
4
|
-
export declare function warnUntrustedInstallScripts(allowedScripts: string[], lockFileName: string, { force }?: Options): void;
|
|
5
|
-
export {};
|
|
1
|
+
export declare function warnUntrustedInstallScripts(allowedScripts: string[]): void;
|
|
6
2
|
//# sourceMappingURL=warn-untrusted-install-scripts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warn-untrusted-install-scripts.d.ts","sourceRoot":"","sources":["../../src/utils/warn-untrusted-install-scripts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"warn-untrusted-install-scripts.d.ts","sourceRoot":"","sources":["../../src/utils/warn-untrusted-install-scripts.ts"],"names":[],"mappings":"AAsBA,wBAAgB,2BAA2B,CAAC,cAAc,EAAE,MAAM,EAAE,QAmBnE"}
|
|
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "warnUntrustedInstallScripts", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _getpackageswithinstallscripts = require("./get-packages-with-install-scripts");
|
|
12
|
-
const _haslockfilechanged = require("./has-lockfile-changed");
|
|
13
12
|
// These packages have scripts, but don't need them to function correctly.
|
|
14
13
|
const IGNORE = [
|
|
15
14
|
'@parcel/watcher',
|
|
@@ -27,10 +26,7 @@ const IGNORE = [
|
|
|
27
26
|
'tree-sitter-json',
|
|
28
27
|
'unrs-resolver'
|
|
29
28
|
];
|
|
30
|
-
function warnUntrustedInstallScripts(allowedScripts
|
|
31
|
-
if (!force && !(0, _haslockfilechanged.hasLockfileChanged)(lockFileName)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
29
|
+
function warnUntrustedInstallScripts(allowedScripts) {
|
|
34
30
|
const packages = (0, _getpackageswithinstallscripts.getPackagesWithInstallScripts)();
|
|
35
31
|
const trustedOrIgnored = new Set([
|
|
36
32
|
...allowedScripts,
|
|
@@ -45,7 +41,6 @@ function warnUntrustedInstallScripts(allowedScripts, lockFileName, { force } = {
|
|
|
45
41
|
const list = untrusted.map(({ name, version })=>` - ${name}@${version}`).join('\n');
|
|
46
42
|
console.warn([
|
|
47
43
|
'WARNING: The following packages have untrusted install scripts.',
|
|
48
|
-
'A future release will block them by default.',
|
|
49
44
|
'Review and add trusted packages to --allow-scripts:',
|
|
50
45
|
list
|
|
51
46
|
].join('\n'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/warn-untrusted-install-scripts.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { getPackagesWithInstallScripts } from './get-packages-with-install-scripts';\
|
|
1
|
+
{"version":3,"sources":["../../src/utils/warn-untrusted-install-scripts.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { getPackagesWithInstallScripts } from './get-packages-with-install-scripts';\n\n// These packages have scripts, but don't need them to function correctly.\n\nconst IGNORE = [\n '@parcel/watcher', // Installs platform-specific binary via optionalDependencies, install script is a legacy fallback\n '@progress/kendo-licensing', // Validates Kendo UI license key, not needed for functionality\n '@scarf/scarf', // Sends anonymous analytics/telemetry to Scarf, usage-tracking mechanism with no functional purpose\n '@swc/core', // Installs platform-specific binary via optionalDependencies, postinstall is a legacy fallback\n '@tree-sitter-grammars/tree-sitter-yaml', // Ships prebuilds for all supported targets via node-gyp-build, install script is a source-compile fallback\n '@vaadin/vaadin-usage-statistics', // Toggles Vaadin's development-time telemetry, no effect on functionality\n 'contentful', // v9 printed a message announcing that v10 was available, no functional purpose\n 'core-js-pure', // Prints a donation/sponsorship banner to the console, no functional purpose\n 'core-js', // Prints a donation/sponsorship banner to the console, no functional purpose\n 'es5-ext', // Displays politically motivated message targeted at Russian developers, no effect on functionality\n 'esbuild', // Installs platform-specific binary via optionalDependencies, postinstall is a legacy fallback\n 'less', // Installs Playwright browsers for Less's own test suite\n 'tree-sitter-json', // Ships prebuilds for all supported targets via node-gyp-build, install script is a source-compile fallback\n 'unrs-resolver', // Installs platform-specific binary via optionalDependencies, postinstall is a legacy fallback\n];\n\nexport function warnUntrustedInstallScripts(allowedScripts: string[]) {\n const packages = getPackagesWithInstallScripts();\n const trustedOrIgnored = new Set([...allowedScripts, ...IGNORE]);\n const untrusted = packages.filter(({ location, name }) => {\n return !!location && !trustedOrIgnored.has(name);\n });\n\n if (untrusted.length === 0) {\n return;\n }\n\n const list = untrusted.map(({ name, version }) => ` - ${name}@${version}`).join('\\n');\n console.warn(\n [\n 'WARNING: The following packages have untrusted install scripts.',\n 'Review and add trusted packages to --allow-scripts:',\n list,\n ].join('\\n')\n );\n}\n"],"names":["warnUntrustedInstallScripts","IGNORE","allowedScripts","packages","getPackagesWithInstallScripts","trustedOrIgnored","Set","untrusted","filter","location","name","has","length","list","map","version","join","console","warn"],"mappings":"AAAA,6BAA6B;;;;+BAsBbA;;;eAAAA;;;+CArB8B;AAE9C,0EAA0E;AAE1E,MAAMC,SAAS;IACX;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACH;AAEM,SAASD,4BAA4BE,cAAwB;IAChE,MAAMC,WAAWC,IAAAA,4DAA6B;IAC9C,MAAMC,mBAAmB,IAAIC,IAAI;WAAIJ;WAAmBD;KAAO;IAC/D,MAAMM,YAAYJ,SAASK,MAAM,CAAC,CAAC,EAAEC,QAAQ,EAAEC,IAAI,EAAE;QACjD,OAAO,CAAC,CAACD,YAAY,CAACJ,iBAAiBM,GAAG,CAACD;IAC/C;IAEA,IAAIH,UAAUK,MAAM,KAAK,GAAG;QACxB;IACJ;IAEA,MAAMC,OAAON,UAAUO,GAAG,CAAC,CAAC,EAAEJ,IAAI,EAAEK,OAAO,EAAE,GAAK,CAAC,IAAI,EAAEL,KAAK,CAAC,EAAEK,SAAS,EAAEC,IAAI,CAAC;IACjFC,QAAQC,IAAI,CACR;QACI;QACA;QACAL;KACH,CAACG,IAAI,CAAC;AAEf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/install",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.4.0",
|
|
4
4
|
"description": "Lightweight wrapper around npm install that configures access to private packages",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/uikit/install",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"webpack": false
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"js-yaml": "~4.
|
|
33
|
+
"js-yaml": "~4.2.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependenciesMeta": {
|
|
36
36
|
"js-yaml": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"ts-node": "~10.9.2"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "8beab9ae3a70ce381e8cd53f2de8691640e96c6e"
|
|
44
44
|
}
|
|
@@ -44,11 +44,7 @@ export class NpmPackageManager extends PackageManager<NpmLockFile> {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
installPackages(args: InstallArgs = {}, options?: Parameters<typeof runCommand>[2]) {
|
|
47
|
-
|
|
48
|
-
* The `true` fallback allows projects a grace period to identify and
|
|
49
|
-
* allowlist trusted scripts. Remove the fallback when the grace period expires.
|
|
50
|
-
*/
|
|
51
|
-
const allowScripts = resolveAllowScripts(args.allowScripts ?? true);
|
|
47
|
+
const allowScripts = resolveAllowScripts(args.allowScripts ?? []);
|
|
52
48
|
|
|
53
49
|
if (!args.quiet) {
|
|
54
50
|
logAllowedScripts(allowScripts);
|
|
@@ -86,9 +82,7 @@ export class NpmPackageManager extends PackageManager<NpmLockFile> {
|
|
|
86
82
|
*/
|
|
87
83
|
if (allowScripts !== false) {
|
|
88
84
|
warnUntrustedInstallScripts(
|
|
89
|
-
Array.isArray(allowScripts) ? allowScripts : DEFAULT_ALLOWED_SCRIPTS
|
|
90
|
-
this.lockFileName,
|
|
91
|
-
{ force: true }
|
|
85
|
+
Array.isArray(allowScripts) ? allowScripts : DEFAULT_ALLOWED_SCRIPTS
|
|
92
86
|
);
|
|
93
87
|
}
|
|
94
88
|
/*
|
|
@@ -105,7 +99,7 @@ export class NpmPackageManager extends PackageManager<NpmLockFile> {
|
|
|
105
99
|
}
|
|
106
100
|
|
|
107
101
|
protected parseLockFile(): NpmLockFile | undefined {
|
|
108
|
-
const lockFilePath = this.
|
|
102
|
+
const lockFilePath = this.getLockFilePath();
|
|
109
103
|
if (!lockFilePath) {
|
|
110
104
|
return undefined;
|
|
111
105
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fs from '
|
|
1
|
+
import fs from 'fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { findUp, runCommand } from '../utils';
|
|
4
4
|
|
|
@@ -27,18 +27,31 @@ export abstract class PackageManager<LockFile = unknown> {
|
|
|
27
27
|
|
|
28
28
|
#lockFile: LockFile | undefined;
|
|
29
29
|
#lockFileLoaded = false;
|
|
30
|
+
#lockFilePath: string | undefined;
|
|
31
|
+
#lockFilePathLoaded = false;
|
|
30
32
|
|
|
31
33
|
hasValidLockFile(): boolean {
|
|
32
34
|
return this.getLockFile() !== undefined;
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
getLockFilePath(): string | undefined {
|
|
38
|
+
if (!this.#lockFilePathLoaded) {
|
|
39
|
+
this.#lockFilePath = findUp(directory => {
|
|
40
|
+
const candidate = path.join(directory, this.lockFileName);
|
|
41
|
+
return fs.existsSync(candidate) ? candidate : undefined;
|
|
42
|
+
});
|
|
43
|
+
this.#lockFilePathLoaded = true;
|
|
44
|
+
}
|
|
45
|
+
return this.#lockFilePath;
|
|
46
|
+
}
|
|
47
|
+
|
|
35
48
|
/**
|
|
36
49
|
* Returns the lockfile key for a package given its absolute or
|
|
37
50
|
* cwd-relative directory. Both npm and pnpm key their lockfile entries
|
|
38
51
|
* by the package's path relative to the workspace root.
|
|
39
52
|
*/
|
|
40
53
|
getWorkspacePackage(packageDir = process.cwd()): string {
|
|
41
|
-
const lockFilePath = this.
|
|
54
|
+
const lockFilePath = this.getLockFilePath();
|
|
42
55
|
if (!lockFilePath) {
|
|
43
56
|
return this.rootWorkspacePackage;
|
|
44
57
|
}
|
|
@@ -60,13 +73,8 @@ export abstract class PackageManager<LockFile = unknown> {
|
|
|
60
73
|
protected reset() {
|
|
61
74
|
this.#lockFile = undefined;
|
|
62
75
|
this.#lockFileLoaded = false;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
protected findLockFilePath(): string | undefined {
|
|
66
|
-
return findUp(directory => {
|
|
67
|
-
const candidate = path.join(directory, this.lockFileName);
|
|
68
|
-
return fs.existsSync(candidate) ? candidate : undefined;
|
|
69
|
-
});
|
|
76
|
+
this.#lockFilePath = undefined;
|
|
77
|
+
this.#lockFilePathLoaded = false;
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
protected get rootWorkspacePackage(): string {
|
|
@@ -70,7 +70,7 @@ export class PnpmPackageManager extends PackageManager<PnpmLockFile> {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
protected parseLockFile(): PnpmLockFile | undefined {
|
|
73
|
-
const lockFilePath = this.
|
|
73
|
+
const lockFilePath = this.getLockFilePath();
|
|
74
74
|
if (!lockFilePath) {
|
|
75
75
|
return undefined;
|
|
76
76
|
}
|
|
@@ -6,9 +6,14 @@ interface PackageWithScript {
|
|
|
6
6
|
version: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
/*
|
|
10
|
+
* Keep this selector free of whitespace. On Windows npm runs through a shell (npm.CMD) and
|
|
11
|
+
* execFileSync passes args unquoted, so a space would split the selector at the shell and npm
|
|
12
|
+
* query would receive a truncated, invalid selector.
|
|
13
|
+
*/
|
|
9
14
|
const SELECTORS = ['preinstall', 'install', 'postinstall']
|
|
10
|
-
.map(script => `:attr(scripts,
|
|
11
|
-
.join(',
|
|
15
|
+
.map(script => `:attr(scripts,[${script}])`)
|
|
16
|
+
.join(',');
|
|
12
17
|
|
|
13
18
|
export function getPackagesWithInstallScripts(): PackageWithScript[] {
|
|
14
19
|
try {
|
package/src/utils/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import { getPackagesWithInstallScripts } from './get-packages-with-install-scripts';
|
|
3
|
-
import { hasLockfileChanged } from './has-lockfile-changed';
|
|
4
3
|
|
|
5
4
|
// These packages have scripts, but don't need them to function correctly.
|
|
6
5
|
|
|
@@ -21,19 +20,7 @@ const IGNORE = [
|
|
|
21
20
|
'unrs-resolver', // Installs platform-specific binary via optionalDependencies, postinstall is a legacy fallback
|
|
22
21
|
];
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
force?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function warnUntrustedInstallScripts(
|
|
29
|
-
allowedScripts: string[],
|
|
30
|
-
lockFileName: string,
|
|
31
|
-
{ force }: Options = {}
|
|
32
|
-
) {
|
|
33
|
-
if (!force && !hasLockfileChanged(lockFileName)) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
23
|
+
export function warnUntrustedInstallScripts(allowedScripts: string[]) {
|
|
37
24
|
const packages = getPackagesWithInstallScripts();
|
|
38
25
|
const trustedOrIgnored = new Set([...allowedScripts, ...IGNORE]);
|
|
39
26
|
const untrusted = packages.filter(({ location, name }) => {
|
|
@@ -48,7 +35,6 @@ export function warnUntrustedInstallScripts(
|
|
|
48
35
|
console.warn(
|
|
49
36
|
[
|
|
50
37
|
'WARNING: The following packages have untrusted install scripts.',
|
|
51
|
-
'A future release will block them by default.',
|
|
52
38
|
'Review and add trusted packages to --allow-scripts:',
|
|
53
39
|
list,
|
|
54
40
|
].join('\n')
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"has-lockfile-changed.d.ts","sourceRoot":"","sources":["../../src/utils/has-lockfile-changed.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,WAOtD"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "hasLockfileChanged", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return hasLockfileChanged;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _os = require("./os");
|
|
12
|
-
function hasLockfileChanged(lockFileName) {
|
|
13
|
-
try {
|
|
14
|
-
const result = (0, _os.runCommand)('git', [
|
|
15
|
-
'diff',
|
|
16
|
-
'--name-only',
|
|
17
|
-
'HEAD',
|
|
18
|
-
'--',
|
|
19
|
-
lockFileName
|
|
20
|
-
]);
|
|
21
|
-
return result.trim().length > 0;
|
|
22
|
-
} catch (unused) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=has-lockfile-changed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/has-lockfile-changed.ts"],"sourcesContent":["import { runCommand } from './os';\n\nexport function hasLockfileChanged(lockFileName: string) {\n try {\n const result = runCommand('git', ['diff', '--name-only', 'HEAD', '--', lockFileName]);\n return result.trim().length > 0;\n } catch {\n return true;\n }\n}\n"],"names":["hasLockfileChanged","lockFileName","result","runCommand","trim","length"],"mappings":";;;;+BAEgBA;;;eAAAA;;;oBAFW;AAEpB,SAASA,mBAAmBC,YAAoB;IACnD,IAAI;QACA,MAAMC,SAASC,IAAAA,cAAU,EAAC,OAAO;YAAC;YAAQ;YAAe;YAAQ;YAAMF;SAAa;QACpF,OAAOC,OAAOE,IAAI,GAAGC,MAAM,GAAG;IAClC,EAAE,eAAM;QACJ,OAAO;IACX;AACJ"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { runCommand } from './os';
|
|
2
|
-
|
|
3
|
-
export function hasLockfileChanged(lockFileName: string) {
|
|
4
|
-
try {
|
|
5
|
-
const result = runCommand('git', ['diff', '--name-only', 'HEAD', '--', lockFileName]);
|
|
6
|
-
return result.trim().length > 0;
|
|
7
|
-
} catch {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
}
|