@rushstack/rundown 1.1.46 → 1.1.47
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/lib/Rundown.d.ts.map +1 -1
- package/lib/Rundown.js +6 -3
- package/lib/Rundown.js.map +1 -1
- package/lib/launcher.js +0 -11
- package/lib/launcher.js.map +1 -1
- package/package.json +4 -4
package/lib/Rundown.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/lib/Rundown.js
CHANGED
|
@@ -131,9 +131,12 @@ class Rundown {
|
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
await new Promise((resolve, reject) => {
|
|
134
|
-
childProcess.on('
|
|
135
|
-
if (
|
|
136
|
-
reject(new Error('Child process terminated
|
|
134
|
+
childProcess.on('close', (exitCode, signal) => {
|
|
135
|
+
if (signal) {
|
|
136
|
+
reject(new Error('Child process terminated by ' + signal));
|
|
137
|
+
}
|
|
138
|
+
else if (exitCode !== 0 && !ignoreExitCode) {
|
|
139
|
+
reject(new Error('Child process terminated with exit code ' + exitCode));
|
|
137
140
|
}
|
|
138
141
|
else if (!completedNormally) {
|
|
139
142
|
reject(new Error('Child process terminated without completing IPC handshake'));
|
package/lib/Rundown.js.map
CHANGED
|
@@ -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;
|
|
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,GAA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G,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;YACvE,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,QAAuB,EAAE,MAA6B,EAAQ,EAAE;gBACxF,IAAI,MAAM,EAAE,CAAC;oBACX,MAAM,CAAC,IAAI,KAAK,CAAC,8BAA8B,GAAG,MAAM,CAAC,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 { 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"]}
|
package/lib/launcher.js
CHANGED
|
@@ -44,12 +44,6 @@ class Launcher {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Synchronously delay for the specified time interval.
|
|
49
|
-
*/
|
|
50
|
-
static _delayMs(milliseconds) {
|
|
51
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, milliseconds);
|
|
52
|
-
}
|
|
53
47
|
installHook() {
|
|
54
48
|
const realRequire = moduleApi.Module.prototype.require;
|
|
55
49
|
const importedModules = this._importedModules; // for closure
|
|
@@ -102,11 +96,6 @@ class Launcher {
|
|
|
102
96
|
process_1.default.send({
|
|
103
97
|
id: 'done'
|
|
104
98
|
});
|
|
105
|
-
// The Node.js "exit" event is synchronous, and the process will terminate as soon as this function returns.
|
|
106
|
-
// To avoid a race condition, allow some time for IPC messages to be transmitted to the parent process.
|
|
107
|
-
// TODO: There should be a way to eliminate this delay by intercepting earlier in the shutdown sequence,
|
|
108
|
-
// but it needs to consider every way that Node.js can exit.
|
|
109
|
-
Launcher._delayMs(500);
|
|
110
99
|
});
|
|
111
100
|
}
|
|
112
101
|
}
|
package/lib/launcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAE3D,oCAAqC;AACrC,sDAA8B;AAK9B,sFAAsF;AACtF,MAAM,cAAc,GAAW,GAAG,CAAC;AAEnC,MAAM,QAAQ;IAAd;QACS,WAAM,0CAA0C;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;
|
|
1
|
+
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;AAE3D,oCAAqC;AACrC,sDAA8B;AAK9B,sFAAsF;AACtF,MAAM,cAAc,GAAW,GAAG,CAAC;AAEnC,MAAM,QAAQ;IAAd;QACS,WAAM,0CAA0C;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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,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,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: NodeJS.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.
|
|
3
|
+
"version": "1.1.47",
|
|
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,11 +18,11 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"string-argv": "~0.3.1",
|
|
21
|
-
"@rushstack/
|
|
22
|
-
"@rushstack/
|
|
21
|
+
"@rushstack/ts-command-line": "4.21.1",
|
|
22
|
+
"@rushstack/node-core-library": "5.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@rushstack/heft": "0.66.
|
|
25
|
+
"@rushstack/heft": "0.66.10",
|
|
26
26
|
"local-node-rig": "1.0.0"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|