@rushstack/rundown 1.1.53 → 1.1.54

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.
@@ -1,4 +1,4 @@
1
- export declare const enum LauncherAction {
1
+ export declare enum LauncherAction {
2
2
  Snapshot = "snapshot",
3
3
  Inspect = "inspect"
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LauncherTypes.d.ts","sourceRoot":"","sources":["../src/LauncherTypes.ts"],"names":[],"mappings":"AAGA,0BAAkB,cAAc;IAC9B,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"LauncherTypes.d.ts","sourceRoot":"","sources":["../src/LauncherTypes.ts"],"names":[],"mappings":"AAGA,oBAAY,cAAc;IACxB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC"}
@@ -2,4 +2,10 @@
2
2
  // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.LauncherAction = void 0;
6
+ var LauncherAction;
7
+ (function (LauncherAction) {
8
+ LauncherAction["Snapshot"] = "snapshot";
9
+ LauncherAction["Inspect"] = "inspect";
10
+ })(LauncherAction || (exports.LauncherAction = LauncherAction = {}));
5
11
  //# sourceMappingURL=LauncherTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LauncherTypes.js","sourceRoot":"","sources":["../src/LauncherTypes.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport const enum LauncherAction {\n Snapshot = 'snapshot',\n Inspect = 'inspect'\n}\n\nexport interface IIpcTraceRecord {\n importedModule: string;\n callingModule: string;\n}\n\nexport interface IIpcTrace {\n id: 'trace';\n records: IIpcTraceRecord[];\n}\n\nexport interface IIpcDone {\n id: 'done';\n}\n\nexport type IpcMessage = IIpcTrace | IIpcDone;\n"]}
1
+ {"version":3,"file":"LauncherTypes.js","sourceRoot":"","sources":["../src/LauncherTypes.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,uCAAqB,CAAA;IACrB,qCAAmB,CAAA;AACrB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport enum LauncherAction {\n Snapshot = 'snapshot',\n Inspect = 'inspect'\n}\n\nexport interface IIpcTraceRecord {\n importedModule: string;\n callingModule: string;\n}\n\nexport interface IIpcTrace {\n id: 'trace';\n records: IIpcTraceRecord[];\n}\n\nexport interface IIpcDone {\n id: 'done';\n}\n\nexport type IpcMessage = IIpcTrace | IIpcDone;\n"]}
package/lib/launcher.js CHANGED
@@ -7,11 +7,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  const moduleApi = require("module");
9
9
  const process_1 = __importDefault(require("process"));
10
+ const LauncherTypes_1 = require("./LauncherTypes"); // "import type" doesn't work with const enums
10
11
  // The _ipcTraceRecordsBatch will get transmitted when this many items are accumulated
11
12
  const IPC_BATCH_SIZE = 300;
12
13
  class Launcher {
13
14
  constructor() {
14
- this.action = "inspect" /* LauncherAction.Inspect */;
15
+ this.action = LauncherTypes_1.LauncherAction.Inspect;
15
16
  this.targetScriptPathArg = '';
16
17
  this.reportPath = '';
17
18
  this._importedModules = new Set();
@@ -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;IAiGxD,CAAC;IA/FQ,aAAa,CAAC,IAA2B;QAC9C,IAAI,OAAe,CAAC;QACpB,IAAI,aAAuB,CAAC;QAE5B,wBAAwB;QACxB,8FAA8F;QAC9F,CAAC,OAAO,EAAE,AAAD,EAAG,IAAI,CAAC,mBAAmB,EAAE,GAAG,aAAa,CAAC,GAAG,IAAI,CAAC;QAE/D,wBAAwB;QACxB,uEAAuE;QACvE,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,GAAG,aAAa,CAAC,CAAC;IAC/D,CAAC;IAED,8DAA8D;IACtD,MAAM,CAAC,eAAe,CAAC,GAAQ,EAAE,GAAQ;QAC/C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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"]}
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;QACxB,8FAA8F;QAC9F,CAAC,OAAO,EAAE,AAAD,EAAG,IAAI,CAAC,mBAAmB,EAAE,GAAG,aAAa,CAAC,GAAG,IAAI,CAAC;QAE/D,wBAAwB;QACxB,uEAAuE;QACvE,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,GAAG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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.53",
3
+ "version": "1.1.54",
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,12 +18,12 @@
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
20
  "string-argv": "~0.3.1",
21
- "@rushstack/node-core-library": "5.4.0",
22
- "@rushstack/ts-command-line": "4.21.5"
21
+ "@rushstack/node-core-library": "5.4.1",
22
+ "@rushstack/ts-command-line": "4.22.0"
23
23
  },
24
24
  "devDependencies": {
25
- "local-node-rig": "1.0.0",
26
- "@rushstack/heft": "0.66.16"
25
+ "@rushstack/heft": "0.66.17",
26
+ "local-node-rig": "1.0.0"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "heft build --clean",