@rushstack/rundown 1.1.110 → 1.2.1

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/CHANGELOG.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "@rushstack/rundown",
3
3
  "entries": [
4
+ {
5
+ "version": "1.2.1",
6
+ "tag": "@rushstack/rundown_v1.2.1",
7
+ "date": "Wed, 08 Oct 2025 00:13:29 GMT",
8
+ "comments": {
9
+ "dependency": [
10
+ {
11
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `5.17.0`"
12
+ },
13
+ {
14
+ "comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.1.1`"
15
+ },
16
+ {
17
+ "comment": "Updating dependency \"@rushstack/heft\" to `1.1.1`"
18
+ }
19
+ ]
20
+ }
21
+ },
22
+ {
23
+ "version": "1.2.0",
24
+ "tag": "@rushstack/rundown_v1.2.0",
25
+ "date": "Fri, 03 Oct 2025 20:09:59 GMT",
26
+ "comments": {
27
+ "minor": [
28
+ {
29
+ "comment": "Normalize import of builtin modules to use the `node:` protocol."
30
+ }
31
+ ],
32
+ "dependency": [
33
+ {
34
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `5.16.0`"
35
+ },
36
+ {
37
+ "comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.1.0`"
38
+ },
39
+ {
40
+ "comment": "Updating dependency \"@rushstack/heft\" to `1.1.0`"
41
+ }
42
+ ]
43
+ }
44
+ },
4
45
  {
5
46
  "version": "1.1.110",
6
47
  "tag": "@rushstack/rundown_v1.1.110",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Change Log - @rushstack/rundown
2
2
 
3
- This log was last generated on Tue, 30 Sep 2025 23:57:45 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 08 Oct 2025 00:13:29 GMT and should not be manually modified.
4
+
5
+ ## 1.2.1
6
+ Wed, 08 Oct 2025 00:13:29 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 1.2.0
11
+ Fri, 03 Oct 2025 20:09:59 GMT
12
+
13
+ ### Minor changes
14
+
15
+ - Normalize import of builtin modules to use the `node:` protocol.
4
16
 
5
17
  ## 1.1.110
6
18
  Tue, 30 Sep 2025 23:57:45 GMT
@@ -1 +1 @@
1
- {"version":3,"file":"Rundown.d.ts","sourceRoot":"","sources":["../src/Rundown.ts"],"names":[],"mappings":"AAUA,qBAAa,OAAO;IAElB,OAAO,CAAC,kBAAkB,CAAkC;IAE/C,WAAW,CACtB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,OAAO,GACtB,OAAO,CAAC,IAAI,CAAC;IAsBT,mBAAmB,IAAI,IAAI;IA8B3B,kBAAkB,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI;YAoCxC,mBAAmB;CAwClC"}
1
+ {"version":3,"file":"Rundown.d.ts","sourceRoot":"","sources":["../src/Rundown.ts"],"names":[],"mappings":"AAYA,qBAAa,OAAO;IAElB,OAAO,CAAC,kBAAkB,CAAkC;IAE/C,WAAW,CACtB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,OAAO,GACtB,OAAO,CAAC,IAAI,CAAC;IAsBT,mBAAmB,IAAI,IAAI;IA8B3B,kBAAkB,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI;YAoCxC,mBAAmB;CAwClC"}
package/lib/Rundown.js CHANGED
@@ -39,10 +39,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  };
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.Rundown = void 0;
42
- const node_core_library_1 = require("@rushstack/node-core-library");
43
- const child_process = __importStar(require("child_process"));
44
- const path = __importStar(require("path"));
42
+ const child_process = __importStar(require("node:child_process"));
43
+ const path = __importStar(require("node:path"));
45
44
  const string_argv_1 = __importDefault(require("string-argv"));
45
+ const node_core_library_1 = require("@rushstack/node-core-library");
46
46
  class Rundown {
47
47
  constructor() {
48
48
  // Map from required path --> caller path
@@ -1 +1 @@
1
- {"version":3,"file":"Rundown.js","sourceRoot":"","sources":["../src/Rundown.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAAyF;AACzF,6DAA+C;AAC/C,2CAA6B;AAC7B,8DAAqC;AAIrC,MAAa,OAAO;IAApB;QACE,yCAAyC;QACjC,uBAAkB,GAAwB,IAAI,GAAG,EAAE,CAAC;IAuI9D,CAAC;IArIQ,KAAK,CAAC,WAAW,CACtB,UAAkB,EAClB,IAAwB,EACxB,KAAc,EACd,cAAuB;QAEvB,IAAI,CAAC,8BAAU,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,4CAA4C,GAAG,UAAU,CAAC,CAAC;QAC7E,CAAC;QACD,MAAM,kBAAkB,GAAW,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE5D,MAAM,YAAY,GAAa,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC;QAE1E,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,CAAC,kBAAkB,EAAE,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACpF,OAAO,CAAC,GAAG,EAAE,CAAC;QAEd,wBAAwB;QACxB,0EAA0E;QAC1E,MAAM,QAAQ,GAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC,CAAC;QAEtG,MAAM,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,KAAK,EAAE,cAAc,CA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CAAC;gBAC3E,CAAC;qBAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;oBAC9B,MAAM,CAAC,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC,CAAC;gBACjF,CAAC;qBAAM,CAAC;oBACN,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzID,0BAyIC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { FileSystem, PackageJsonLookup, Sort, Text } from '@rushstack/node-core-library';\nimport * as child_process from 'child_process';\nimport * as path from 'path';\nimport stringArgv from 'string-argv';\n\nimport type { IpcMessage } from './LauncherTypes';\n\nexport class Rundown {\n // Map from required path --> caller path\n private _importedModuleMap: Map<string, string> = new Map();\n\n public async invokeAsync(\n scriptPath: string,\n args: string | undefined,\n quiet: boolean,\n ignoreExitCode: boolean\n ): Promise<void> {\n if (!FileSystem.exists(scriptPath)) {\n throw new Error('The specified script path does not exist: ' + scriptPath);\n }\n const absoluteScriptPath: string = path.resolve(scriptPath);\n\n const expandedArgs: string[] = args === undefined ? [] : stringArgv(args);\n\n console.log('Starting process: ' + [absoluteScriptPath, ...expandedArgs].join(' '));\n console.log();\n\n // Example process.argv:\n // [\"path/to/launcher.js\", \"path/to/target-script.js\", \"first-target-arg\"]\n const nodeArgs: string[] = [path.join(__dirname, 'launcher.js'), absoluteScriptPath, ...expandedArgs];\n\n await this._spawnLauncherAsync(nodeArgs, quiet, ignoreExitCode);\n\n if (!quiet) {\n console.log();\n }\n }\n\n public writeSnapshotReport(): void {\n const reportPath: string = 'rundown-snapshot.log';\n console.log('Writing report file: ' + reportPath);\n\n const packageJsonLookup: PackageJsonLookup = new PackageJsonLookup();\n const importedPaths: string[] = [...this._importedModuleMap.keys()];\n const importedPackageFolders: Set<string> = new Set();\n\n for (const importedPath of importedPaths) {\n const importedPackageFolder: string | undefined =\n packageJsonLookup.tryGetPackageFolderFor(importedPath);\n if (importedPackageFolder) {\n if (/[\\\\/]node_modules[\\\\/]/i.test(importedPackageFolder)) {\n importedPackageFolders.add(path.basename(importedPackageFolder));\n } else {\n const relativePath: string = path.relative(process.cwd(), importedPackageFolder);\n importedPackageFolders.add(Text.replaceAll(relativePath, '\\\\', '/'));\n }\n } else {\n // If the importedPath does not belong to an NPM package, then rundown-snapshot.log can ignore it.\n // In other words, treat it the same way as the local project's source files.\n }\n }\n\n Sort.sortSet(importedPackageFolders);\n const data: string = [...importedPackageFolders].join('\\n') + '\\n';\n\n FileSystem.writeFile(reportPath, data);\n }\n\n public writeInspectReport(traceImports: boolean): void {\n const reportPath: string = 'rundown-inspect.log';\n console.log('Writing report file: ' + reportPath);\n\n const importedPaths: string[] = [...this._importedModuleMap.keys()];\n importedPaths.sort();\n\n let data: string = '';\n\n if (traceImports) {\n for (const importedPath of importedPaths) {\n data += importedPath + '\\n';\n\n let current: string = importedPath;\n const visited: Set<string> = new Set();\n for (;;) {\n const callerPath: string | undefined = this._importedModuleMap.get(current);\n if (!callerPath) {\n break;\n }\n if (visited.has(callerPath)) {\n break;\n }\n visited.add(callerPath);\n data += ' imported by ' + callerPath + '\\n';\n current = callerPath;\n }\n data += '\\n';\n }\n } else {\n data = importedPaths.join('\\n') + '\\n';\n }\n\n FileSystem.writeFile(reportPath, data);\n }\n\n private async _spawnLauncherAsync(\n nodeArgs: string[],\n quiet: boolean,\n ignoreExitCode: boolean\n ): Promise<void> {\n const childProcess: child_process.ChildProcess = child_process.spawn(process.execPath, nodeArgs, {\n stdio: quiet ? ['inherit', 'ignore', 'ignore', 'ipc'] : ['inherit', 'inherit', 'inherit', 'ipc']\n });\n\n let completedNormally: boolean = false;\n\n childProcess.on('message', (message: IpcMessage): void => {\n switch (message.id) {\n case 'trace':\n for (const record of message.records) {\n this._importedModuleMap.set(record.importedModule, record.callingModule);\n }\n break;\n case 'done':\n completedNormally = true;\n break;\n default:\n throw new Error('Unknown IPC message: ' + JSON.stringify(message));\n }\n });\n\n await new Promise<void>((resolve, reject) => {\n childProcess.on('close', (exitCode: number | null, signal: NodeJS.Signals | null): void => {\n if (signal) {\n reject(new Error('Child process terminated by ' + signal));\n } else if (exitCode !== 0 && !ignoreExitCode) {\n reject(new Error('Child process terminated with exit code ' + exitCode));\n } else if (!completedNormally) {\n reject(new Error('Child process terminated without completing IPC handshake'));\n } else {\n resolve();\n }\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"Rundown.js","sourceRoot":"","sources":["../src/Rundown.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,kEAAoD;AACpD,gDAAkC;AAElC,8DAAqC;AAErC,oEAAyF;AAIzF,MAAa,OAAO;IAApB;QACE,yCAAyC;QACjC,uBAAkB,GAAwB,IAAI,GAAG,EAAE,CAAC;IAuI9D,CAAC;IArIQ,KAAK,CAAC,WAAW,CACtB,UAAkB,EAClB,IAAwB,EACxB,KAAc,EACd,cAAuB;QAEvB,IAAI,CAAC,8BAAU,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,4CAA4C,GAAG,UAAU,CAAC,CAAC;QAC7E,CAAC;QACD,MAAM,kBAAkB,GAAW,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE5D,MAAM,YAAY,GAAa,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC;QAE1E,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,CAAC,kBAAkB,EAAE,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACpF,OAAO,CAAC,GAAG,EAAE,CAAC;QAEd,wBAAwB;QACxB,0EAA0E;QAC1E,MAAM,QAAQ,GAAa,CAAC,IA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C,CAAC,CAAC;gBAC7D,CAAC;qBAAM,IAAI,QAAQ,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;oBAC7C,MAAM,CAAC,IAAI,KAAK,CAAC,0CAA0C,GAAG,QAAQ,CAAC,CAAC,CAAC;gBAC3E,CAAC;qBAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;oBAC9B,MAAM,CAAC,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC,CAAC;gBACjF,CAAC;qBAAM,CAAC;oBACN,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzID,0BAyIC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as child_process from 'node:child_process';\nimport * as path from 'node:path';\n\nimport stringArgv from 'string-argv';\n\nimport { FileSystem, PackageJsonLookup, Sort, Text } from '@rushstack/node-core-library';\n\nimport type { IpcMessage } from './LauncherTypes';\n\nexport class Rundown {\n // Map from required path --> caller path\n private _importedModuleMap: Map<string, string> = new Map();\n\n public async invokeAsync(\n scriptPath: string,\n args: string | undefined,\n quiet: boolean,\n ignoreExitCode: boolean\n ): Promise<void> {\n if (!FileSystem.exists(scriptPath)) {\n throw new Error('The specified script path does not exist: ' + scriptPath);\n }\n const absoluteScriptPath: string = path.resolve(scriptPath);\n\n const expandedArgs: string[] = args === undefined ? [] : stringArgv(args);\n\n console.log('Starting process: ' + [absoluteScriptPath, ...expandedArgs].join(' '));\n console.log();\n\n // Example process.argv:\n // [\"path/to/launcher.js\", \"path/to/target-script.js\", \"first-target-arg\"]\n const nodeArgs: string[] = [path.join(__dirname, 'launcher.js'), absoluteScriptPath, ...expandedArgs];\n\n await this._spawnLauncherAsync(nodeArgs, quiet, ignoreExitCode);\n\n if (!quiet) {\n console.log();\n }\n }\n\n public writeSnapshotReport(): void {\n const reportPath: string = 'rundown-snapshot.log';\n console.log('Writing report file: ' + reportPath);\n\n const packageJsonLookup: PackageJsonLookup = new PackageJsonLookup();\n const importedPaths: string[] = [...this._importedModuleMap.keys()];\n const importedPackageFolders: Set<string> = new Set();\n\n for (const importedPath of importedPaths) {\n const importedPackageFolder: string | undefined =\n packageJsonLookup.tryGetPackageFolderFor(importedPath);\n if (importedPackageFolder) {\n if (/[\\\\/]node_modules[\\\\/]/i.test(importedPackageFolder)) {\n importedPackageFolders.add(path.basename(importedPackageFolder));\n } else {\n const relativePath: string = path.relative(process.cwd(), importedPackageFolder);\n importedPackageFolders.add(Text.replaceAll(relativePath, '\\\\', '/'));\n }\n } else {\n // If the importedPath does not belong to an NPM package, then rundown-snapshot.log can ignore it.\n // In other words, treat it the same way as the local project's source files.\n }\n }\n\n Sort.sortSet(importedPackageFolders);\n const data: string = [...importedPackageFolders].join('\\n') + '\\n';\n\n FileSystem.writeFile(reportPath, data);\n }\n\n public writeInspectReport(traceImports: boolean): void {\n const reportPath: string = 'rundown-inspect.log';\n console.log('Writing report file: ' + reportPath);\n\n const importedPaths: string[] = [...this._importedModuleMap.keys()];\n importedPaths.sort();\n\n let data: string = '';\n\n if (traceImports) {\n for (const importedPath of importedPaths) {\n data += importedPath + '\\n';\n\n let current: string = importedPath;\n const visited: Set<string> = new Set();\n for (;;) {\n const callerPath: string | undefined = this._importedModuleMap.get(current);\n if (!callerPath) {\n break;\n }\n if (visited.has(callerPath)) {\n break;\n }\n visited.add(callerPath);\n data += ' imported by ' + callerPath + '\\n';\n current = callerPath;\n }\n data += '\\n';\n }\n } else {\n data = importedPaths.join('\\n') + '\\n';\n }\n\n FileSystem.writeFile(reportPath, data);\n }\n\n private async _spawnLauncherAsync(\n nodeArgs: string[],\n quiet: boolean,\n ignoreExitCode: boolean\n ): Promise<void> {\n const childProcess: child_process.ChildProcess = child_process.spawn(process.execPath, nodeArgs, {\n stdio: quiet ? ['inherit', 'ignore', 'ignore', 'ipc'] : ['inherit', 'inherit', 'inherit', 'ipc']\n });\n\n let completedNormally: boolean = false;\n\n childProcess.on('message', (message: IpcMessage): void => {\n switch (message.id) {\n case 'trace':\n for (const record of message.records) {\n this._importedModuleMap.set(record.importedModule, record.callingModule);\n }\n break;\n case 'done':\n completedNormally = true;\n break;\n default:\n throw new Error('Unknown IPC message: ' + JSON.stringify(message));\n }\n });\n\n await new Promise<void>((resolve, reject) => {\n childProcess.on('close', (exitCode: number | null, signal: NodeJS.Signals | null): void => {\n if (signal) {\n reject(new Error('Child process terminated by ' + signal));\n } else if (exitCode !== 0 && !ignoreExitCode) {\n reject(new Error('Child process terminated with exit code ' + exitCode));\n } else if (!completedNormally) {\n reject(new Error('Child process terminated without completing IPC handshake'));\n } else {\n resolve();\n }\n });\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SnapshotAction.d.ts","sourceRoot":"","sources":["../../src/cli/SnapshotAction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,qBAAa,cAAe,SAAQ,gBAAgB;;cAWzB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAUzD"}
1
+ {"version":3,"file":"SnapshotAction.d.ts","sourceRoot":"","sources":["../../src/cli/SnapshotAction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,qBAAa,cAAe,SAAQ,gBAAgB;;cAWzB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAUzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"SnapshotAction.js","sourceRoot":"","sources":["../../src/cli/SnapshotAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,yDAAsD;AAEtD,wCAAqC;AAErC,MAAa,cAAe,SAAQ,mCAAgB;IAClD;QACE,KAAK,CAAC;YACJ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,sDAAsD;YAC/D,aAAa,EACX,0GAA0G;gBAC1G,+EAA+E;SAClF,CAAC,CAAC;IACL,CAAC;IAEkB,KAAK,CAAC,cAAc;QACrC,MAAM,OAAO,GAAY,IAAI,iBAAO,EAAE,CAAC;QACvC,MAAM,OAAO,CAAC,WAAW,CACvB,IAAI,CAAC,eAAe,CAAC,KAAK,EAC1B,IAAI,CAAC,aAAa,CAAC,KAAK,EACxB,IAAI,CAAC,cAAc,CAAC,KAAK,EACzB,IAAI,CAAC,uBAAuB,CAAC,KAAK,CACnC,CAAC;QACF,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAChC,CAAC;CACF;AArBD,wCAqBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { BaseReportAction } from './BaseReportAction';\n\nimport { Rundown } from '../Rundown';\n\nexport class SnapshotAction extends BaseReportAction {\n public constructor() {\n super({\n actionName: 'snapshot',\n summary: 'Invoke a Node.js script and generate a test snapshot',\n documentation:\n 'Invoke a Node.js script and generate a test snapshot. This command creates a concise report that can be' +\n ' added to Git, so that its diff can be used to detect performance regressions'\n });\n }\n\n protected override async onExecuteAsync(): Promise<void> {\n const rundown: Rundown = new Rundown();\n await rundown.invokeAsync(\n this.scriptParameter.value,\n this.argsParameter.value,\n this.quietParameter.value,\n this.ignoreExitCodeParameter.value\n );\n rundown.writeSnapshotReport();\n }\n}\n"]}
1
+ {"version":3,"file":"SnapshotAction.js","sourceRoot":"","sources":["../../src/cli/SnapshotAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,yDAAsD;AACtD,wCAAqC;AAErC,MAAa,cAAe,SAAQ,mCAAgB;IAClD;QACE,KAAK,CAAC;YACJ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,sDAAsD;YAC/D,aAAa,EACX,0GAA0G;gBAC1G,+EAA+E;SAClF,CAAC,CAAC;IACL,CAAC;IAEkB,KAAK,CAAC,cAAc;QACrC,MAAM,OAAO,GAAY,IAAI,iBAAO,EAAE,CAAC;QACvC,MAAM,OAAO,CAAC,WAAW,CACvB,IAAI,CAAC,eAAe,CAAC,KAAK,EAC1B,IAAI,CAAC,aAAa,CAAC,KAAK,EACxB,IAAI,CAAC,cAAc,CAAC,KAAK,EACzB,IAAI,CAAC,uBAAuB,CAAC,KAAK,CACnC,CAAC;QACF,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAChC,CAAC;CACF;AArBD,wCAqBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { BaseReportAction } from './BaseReportAction';\nimport { Rundown } from '../Rundown';\n\nexport class SnapshotAction extends BaseReportAction {\n public constructor() {\n super({\n actionName: 'snapshot',\n summary: 'Invoke a Node.js script and generate a test snapshot',\n documentation:\n 'Invoke a Node.js script and generate a test snapshot. This command creates a concise report that can be' +\n ' added to Git, so that its diff can be used to detect performance regressions'\n });\n }\n\n protected override async onExecuteAsync(): Promise<void> {\n const rundown: Rundown = new Rundown();\n await rundown.invokeAsync(\n this.scriptParameter.value,\n this.argsParameter.value,\n this.quietParameter.value,\n this.ignoreExitCodeParameter.value\n );\n rundown.writeSnapshotReport();\n }\n}\n"]}
package/lib/launcher.js CHANGED
@@ -6,7 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  };
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  const moduleApi = require("module");
9
- const process_1 = __importDefault(require("process"));
9
+ const node_process_1 = __importDefault(require("node:process"));
10
10
  const LauncherTypes_1 = require("./LauncherTypes"); // "import type" doesn't work with const enums
11
11
  // The _ipcTraceRecordsBatch will get transmitted when this many items are accumulated
12
12
  const IPC_BATCH_SIZE = 300;
@@ -39,7 +39,7 @@ class Launcher {
39
39
  if (this._ipcTraceRecordsBatch.length > 0) {
40
40
  const batch = [...this._ipcTraceRecordsBatch];
41
41
  this._ipcTraceRecordsBatch.length = 0;
42
- process_1.default.send({
42
+ node_process_1.default.send({
43
43
  id: 'trace',
44
44
  records: batch
45
45
  });
@@ -92,21 +92,21 @@ class Launcher {
92
92
  }
93
93
  moduleApi.Module.prototype.require = hookedRequire;
94
94
  Launcher._copyProperties(hookedRequire, realRequire);
95
- process_1.default.on('exit', () => {
95
+ node_process_1.default.on('exit', () => {
96
96
  this._sendIpcTraceBatch();
97
- process_1.default.send({
97
+ node_process_1.default.send({
98
98
  id: 'done'
99
99
  });
100
100
  });
101
101
  }
102
102
  }
103
- if (!process_1.default.send) {
103
+ if (!node_process_1.default.send) {
104
104
  throw new Error('launcher.js must be invoked via IPC');
105
105
  }
106
106
  const launcher = new Launcher();
107
- const originalArgv = [...process_1.default.argv];
108
- process_1.default.argv.length = 0;
109
- process_1.default.argv.push(...launcher.transformArgs(originalArgv));
107
+ const originalArgv = [...node_process_1.default.argv];
108
+ node_process_1.default.argv.length = 0;
109
+ node_process_1.default.argv.push(...launcher.transformArgs(originalArgv));
110
110
  launcher.installHook();
111
111
  // Start the app
112
112
  require(launcher.targetScriptPathArg);
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAE3D,oCAAqC;AACrC,sDAA8B;AAE9B,mDAAiD,CAAC,8CAA8C;AAGhG,sFAAsF;AACtF,MAAM,cAAc,GAAW,GAAG,CAAC;AAEnC,MAAM,QAAQ;IAAd;QACS,WAAM,GAAmB,8BAAc,CAAC,OAAO,CAAC;QAChD,wBAAmB,GAAW,EAAE,CAAC;QACjC,eAAU,GAAW,EAAE,CAAC;QACvB,qBAAgB,GAAiB,IAAI,GAAG,EAAE,CAAC;QAC3C,yBAAoB,GAAgB,IAAI,GAAG,EAAE,CAAC;QAC9C,0BAAqB,GAAsB,EAAE,CAAC;IAiGxD,CAAC;IA/FQ,aAAa,CAAC,IAA2B;QAC9C,IAAI,OAAe,CAAC;QACpB,IAAI,aAAuB,CAAC;QAE5B,wBAAwB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AAO,cAAc,CAAC;QACxB,CAAC;QAED,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG,aAA+B,CAAC;QACrE,QAAQ,CAAC,eAAe,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAErD,iBAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACtB,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,iBAAO,CAAC,IAAK,CAAC;gBACZ,EAAE,EAAE,MAAM;aACC,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,IAAI,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC;IAClB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,QAAQ,GAAa,IAAI,QAAQ,EAAE,CAAC;AAE1C,MAAM,YAAY,GAA0B,CAAC,GAAG,iBAAO,CAAC,IAAI,CAAC,CAAC;AAC9D,iBAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AACxB,iBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC;AAE3D,QAAQ,CAAC,WAAW,EAAE,CAAC;AAEvB,gBAAgB;AAChB,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport moduleApi = require('module');\nimport process from 'process';\n\nimport { LauncherAction } from './LauncherTypes'; // \"import type\" doesn't work with const enums\nimport type { IIpcTrace, IIpcDone, IIpcTraceRecord } from './LauncherTypes';\n\n// The _ipcTraceRecordsBatch will get transmitted when this many items are accumulated\nconst IPC_BATCH_SIZE: number = 300;\n\nclass Launcher {\n public action: LauncherAction = LauncherAction.Inspect;\n public targetScriptPathArg: string = '';\n public reportPath: string = '';\n private _importedModules: Set<unknown> = new Set();\n private _importedModulePaths: Set<string> = new Set();\n private _ipcTraceRecordsBatch: IIpcTraceRecord[] = [];\n\n public transformArgs(argv: ReadonlyArray<string>): string[] {\n let nodeArg: string;\n let remainderArgs: string[];\n\n // Example process.argv:\n // [\"path/to/node.exe\", \"path/to/launcher.js\", \"path/to/target-script.js\", \"first-target-arg\"]\n [nodeArg, , this.targetScriptPathArg, ...remainderArgs] = argv;\n\n // Example process.argv:\n // [\"path/to/node.exe\", \"path/to/target-script.js\", \"first-target-arg\"]\n return [nodeArg, this.targetScriptPathArg, ...remainderArgs];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private static _copyProperties(dst: any, src: any): void {\n for (const prop of Object.keys(src)) {\n dst[prop] = src[prop];\n }\n }\n\n private _sendIpcTraceBatch(): void {\n if (this._ipcTraceRecordsBatch.length > 0) {\n const batch: IIpcTraceRecord[] = [...this._ipcTraceRecordsBatch];\n this._ipcTraceRecordsBatch.length = 0;\n\n process.send!({\n id: 'trace',\n records: batch\n } as IIpcTrace);\n }\n }\n\n public installHook(): void {\n const realRequire: typeof moduleApi.Module.prototype.require = moduleApi.Module.prototype.require;\n\n const importedModules: Set<unknown> = this._importedModules; // for closure\n const importedModulePaths: Set<string> = this._importedModulePaths; // for closure\n const ipcTraceRecordsBatch: IIpcTraceRecord[] = this._ipcTraceRecordsBatch; // for closure\n const sendIpcTraceBatch: () => void = this._sendIpcTraceBatch.bind(this); // for closure\n\n function hookedRequire(this: NodeModule, moduleName: string): unknown {\n // NOTE: The \"this\" pointer is the calling NodeModule, so we rely on closure\n // variable here.\n const callingModuleInfo: NodeModule = this;\n\n // Paranoidly use \"arguments\" in case some implementor passes additional undocumented arguments\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const importedModule: unknown = (realRequire as any).apply(callingModuleInfo, arguments);\n\n if (!importedModules.has(importedModule)) {\n importedModules.add(importedModule);\n\n // Find the info for the imported module\n let importedModuleInfo: NodeModule | undefined = undefined;\n const children: NodeModule[] = callingModuleInfo.children || [];\n for (const child of children) {\n if (child.exports === importedModule) {\n importedModuleInfo = child;\n break;\n }\n }\n\n if (importedModuleInfo === undefined) {\n // It's a built-in module like \"os\"\n } else {\n if (!importedModuleInfo.filename) {\n throw new Error('Missing filename for ' + moduleName);\n }\n\n if (!importedModulePaths.has(importedModuleInfo.filename)) {\n importedModulePaths.add(importedModuleInfo.filename);\n ipcTraceRecordsBatch.push({\n importedModule: importedModuleInfo.filename,\n callingModule: callingModuleInfo.filename\n });\n if (ipcTraceRecordsBatch.length >= IPC_BATCH_SIZE) {\n sendIpcTraceBatch();\n }\n }\n }\n }\n\n return importedModule;\n }\n\n moduleApi.Module.prototype.require = hookedRequire as NodeJS.Require;\n Launcher._copyProperties(hookedRequire, realRequire);\n\n process.on('exit', () => {\n this._sendIpcTraceBatch();\n process.send!({\n id: 'done'\n } as IIpcDone);\n });\n }\n}\n\nif (!process.send) {\n throw new Error('launcher.js must be invoked via IPC');\n}\n\nconst launcher: Launcher = new Launcher();\n\nconst originalArgv: ReadonlyArray<string> = [...process.argv];\nprocess.argv.length = 0;\nprocess.argv.push(...launcher.transformArgs(originalArgv));\n\nlauncher.installHook();\n\n// Start the app\nrequire(launcher.targetScriptPathArg);\n"]}
1
+ {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAE3D,oCAAqC;AACrC,gEAAmC;AAEnC,mDAAiD,CAAC,8CAA8C;AAGhG,sFAAsF;AACtF,MAAM,cAAc,GAAW,GAAG,CAAC;AAEnC,MAAM,QAAQ;IAAd;QACS,WAAM,GAAmB,8BAAc,CAAC,OAAO,CAAC;QAChD,wBAAmB,GAAW,EAAE,CAAC;QACjC,eAAU,GAAW,EAAE,CAAC;QACvB,qBAAgB,GAAiB,IAAI,GAAG,EAAE,CAAC;QAC3C,yBAAoB,GAAgB,IAAI,GAAG,EAAE,CAAC;QAC9C,0BAAqB,GAAsB,EAAE,C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MAAM,IAAI,cAAc,EAAE,CAAC;4BAClD,iBAAiB,EAAE,CAAC;wBACtB,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,GAAG,aAA+B,CAAC;QACrE,QAAQ,CAAC,eAAe,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAErD,sBAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACtB,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,sBAAO,CAAC,IAAK,CAAC;gBACZ,EAAE,EAAE,MAAM;aACC,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,IAAI,CAAC,sBAAO,CAAC,IAAI,EAAE,CAAC;IAClB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,QAAQ,GAAa,IAAI,QAAQ,EAAE,CAAC;AAE1C,MAAM,YAAY,GAA0B,CAAC,GAAG,sBAAO,CAAC,IAAI,CAAC,CAAC;AAC9D,sBAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AACxB,sBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC;AAE3D,QAAQ,CAAC,WAAW,EAAE,CAAC;AAEvB,gBAAgB;AAChB,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport moduleApi = require('module');\nimport process from 'node:process';\n\nimport { LauncherAction } from './LauncherTypes'; // \"import type\" doesn't work with const enums\nimport type { IIpcTrace, IIpcDone, IIpcTraceRecord } from './LauncherTypes';\n\n// The _ipcTraceRecordsBatch will get transmitted when this many items are accumulated\nconst IPC_BATCH_SIZE: number = 300;\n\nclass Launcher {\n public action: LauncherAction = LauncherAction.Inspect;\n public targetScriptPathArg: string = '';\n public reportPath: string = '';\n private _importedModules: Set<unknown> = new Set();\n private _importedModulePaths: Set<string> = new Set();\n private _ipcTraceRecordsBatch: IIpcTraceRecord[] = [];\n\n public transformArgs(argv: ReadonlyArray<string>): string[] {\n let nodeArg: string;\n let remainderArgs: string[];\n\n // Example process.argv:\n // [\"path/to/node.exe\", \"path/to/launcher.js\", \"path/to/target-script.js\", \"first-target-arg\"]\n [nodeArg, , this.targetScriptPathArg, ...remainderArgs] = argv;\n\n // Example process.argv:\n // [\"path/to/node.exe\", \"path/to/target-script.js\", \"first-target-arg\"]\n return [nodeArg, this.targetScriptPathArg, ...remainderArgs];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private static _copyProperties(dst: any, src: any): void {\n for (const prop of Object.keys(src)) {\n dst[prop] = src[prop];\n }\n }\n\n private _sendIpcTraceBatch(): void {\n if (this._ipcTraceRecordsBatch.length > 0) {\n const batch: IIpcTraceRecord[] = [...this._ipcTraceRecordsBatch];\n this._ipcTraceRecordsBatch.length = 0;\n\n process.send!({\n id: 'trace',\n records: batch\n } as IIpcTrace);\n }\n }\n\n public installHook(): void {\n const realRequire: typeof moduleApi.Module.prototype.require = moduleApi.Module.prototype.require;\n\n const importedModules: Set<unknown> = this._importedModules; // for closure\n const importedModulePaths: Set<string> = this._importedModulePaths; // for closure\n const ipcTraceRecordsBatch: IIpcTraceRecord[] = this._ipcTraceRecordsBatch; // for closure\n const sendIpcTraceBatch: () => void = this._sendIpcTraceBatch.bind(this); // for closure\n\n function hookedRequire(this: NodeModule, moduleName: string): unknown {\n // NOTE: The \"this\" pointer is the calling NodeModule, so we rely on closure\n // variable here.\n const callingModuleInfo: NodeModule = this;\n\n // Paranoidly use \"arguments\" in case some implementor passes additional undocumented arguments\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const importedModule: unknown = (realRequire as any).apply(callingModuleInfo, arguments);\n\n if (!importedModules.has(importedModule)) {\n importedModules.add(importedModule);\n\n // Find the info for the imported module\n let importedModuleInfo: NodeModule | undefined = undefined;\n const children: NodeModule[] = callingModuleInfo.children || [];\n for (const child of children) {\n if (child.exports === importedModule) {\n importedModuleInfo = child;\n break;\n }\n }\n\n if (importedModuleInfo === undefined) {\n // It's a built-in module like \"os\"\n } else {\n if (!importedModuleInfo.filename) {\n throw new Error('Missing filename for ' + moduleName);\n }\n\n if (!importedModulePaths.has(importedModuleInfo.filename)) {\n importedModulePaths.add(importedModuleInfo.filename);\n ipcTraceRecordsBatch.push({\n importedModule: importedModuleInfo.filename,\n callingModule: callingModuleInfo.filename\n });\n if (ipcTraceRecordsBatch.length >= IPC_BATCH_SIZE) {\n sendIpcTraceBatch();\n }\n }\n }\n }\n\n return importedModule;\n }\n\n moduleApi.Module.prototype.require = hookedRequire as NodeJS.Require;\n Launcher._copyProperties(hookedRequire, realRequire);\n\n process.on('exit', () => {\n this._sendIpcTraceBatch();\n process.send!({\n id: 'done'\n } as IIpcDone);\n });\n }\n}\n\nif (!process.send) {\n throw new Error('launcher.js must be invoked via IPC');\n}\n\nconst launcher: Launcher = new Launcher();\n\nconst originalArgv: ReadonlyArray<string> = [...process.argv];\nprocess.argv.length = 0;\nprocess.argv.push(...launcher.transformArgs(originalArgv));\n\nlauncher.installHook();\n\n// Start the app\nrequire(launcher.targetScriptPathArg);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rundown",
3
- "version": "1.1.110",
3
+ "version": "1.2.1",
4
4
  "description": "Detect load time regressions by running an app, tracing require() calls, and generating a deterministic report",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,13 +18,13 @@
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
20
  "string-argv": "~0.3.1",
21
- "@rushstack/node-core-library": "5.15.1",
22
- "@rushstack/ts-command-line": "5.0.5"
21
+ "@rushstack/node-core-library": "5.17.0",
22
+ "@rushstack/ts-command-line": "5.1.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "~9.25.1",
26
26
  "local-node-rig": "1.0.0",
27
- "@rushstack/heft": "1.0.0"
27
+ "@rushstack/heft": "1.1.1"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "heft build --clean",