@rushstack/eslint-bulk 0.4.15 → 0.5.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 +40 -0
- package/CHANGELOG.md +15 -1
- package/bin/eslint-bulk +1 -1
- package/lib-esm/start.js +135 -0
- package/lib-esm/start.js.map +1 -0
- package/package.json +25 -6
- /package/{lib → lib-commonjs}/start.js +0 -0
- /package/{lib → lib-commonjs}/start.js.map +0 -0
- /package/{lib → lib-dts}/start.d.ts +0 -0
- /package/{lib → lib-dts}/start.d.ts.map +0 -0
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/eslint-bulk",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.5.1",
|
|
6
|
+
"tag": "@rushstack/eslint-bulk_v0.5.1",
|
|
7
|
+
"date": "Fri, 20 Feb 2026 00:15:04 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644."
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"dependency": [
|
|
15
|
+
{
|
|
16
|
+
"comment": "Updating dependency \"@rushstack/eslint-patch\" to `1.16.1`"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.2.1`"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"version": "0.5.0",
|
|
26
|
+
"tag": "@rushstack/eslint-bulk_v0.5.0",
|
|
27
|
+
"date": "Thu, 19 Feb 2026 00:04:52 GMT",
|
|
28
|
+
"comments": {
|
|
29
|
+
"minor": [
|
|
30
|
+
{
|
|
31
|
+
"comment": "Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `\"exports\"` field in `package.json`."
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"dependency": [
|
|
35
|
+
{
|
|
36
|
+
"comment": "Updating dependency \"@rushstack/eslint-patch\" to `1.16.0`"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.2.0`"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
4
44
|
{
|
|
5
45
|
"version": "0.4.15",
|
|
6
46
|
"tag": "@rushstack/eslint-bulk_v0.4.15",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Change Log - @rushstack/eslint-bulk
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 20 Feb 2026 00:15:04 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.5.1
|
|
6
|
+
Fri, 20 Feb 2026 00:15:04 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Add `"node"` condition before `"import"` in the `"exports"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `"import"`. Fixes https://github.com/microsoft/rushstack/issues/5644.
|
|
11
|
+
|
|
12
|
+
## 0.5.0
|
|
13
|
+
Thu, 19 Feb 2026 00:04:52 GMT
|
|
14
|
+
|
|
15
|
+
### Minor changes
|
|
16
|
+
|
|
17
|
+
- Normalize package layout. CommonJS is now under `lib-commonjs`, DTS is now under `lib-dts`, and ESM is now under `lib-esm`. Imports to `lib` still work as before, handled by the `"exports"` field in `package.json`.
|
|
4
18
|
|
|
5
19
|
## 0.4.15
|
|
6
20
|
Sat, 07 Feb 2026 01:13:26 GMT
|
package/bin/eslint-bulk
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require('../lib/start.js');
|
|
2
|
+
require('../lib-commonjs/start.js');
|
package/lib-esm/start.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
var _a;
|
|
4
|
+
import { execSync, spawnSync } from 'node:child_process';
|
|
5
|
+
import * as process from 'node:process';
|
|
6
|
+
import * as fs from 'node:fs';
|
|
7
|
+
const ESLINT_BULK_STDOUT_START_DELIMETER = 'RUSHSTACK_ESLINT_BULK_START';
|
|
8
|
+
const ESLINT_BULK_STDOUT_END_DELIMETER = 'RUSHSTACK_ESLINT_BULK_END';
|
|
9
|
+
const ESLINT_PACKAGE_NAME_ENV_VAR_NAME = '_RUSHSTACK_ESLINT_PACKAGE_NAME';
|
|
10
|
+
const BULK_SUPPRESSIONS_CLI_ESLINT_PACKAGE_NAME = (_a = process.env[ESLINT_PACKAGE_NAME_ENV_VAR_NAME]) !== null && _a !== void 0 ? _a : 'eslint';
|
|
11
|
+
const ESLINT_CONFIG_FILES = [
|
|
12
|
+
'eslint.config.js',
|
|
13
|
+
'eslint.config.cjs',
|
|
14
|
+
'eslint.config.mjs',
|
|
15
|
+
'.eslintrc.js',
|
|
16
|
+
'.eslintrc.cjs'
|
|
17
|
+
];
|
|
18
|
+
function findPatchPath() {
|
|
19
|
+
const candidatePaths = ESLINT_CONFIG_FILES.map((fileName) => `${process.cwd()}/${fileName}`);
|
|
20
|
+
let eslintConfigPath;
|
|
21
|
+
for (const candidatePath of candidatePaths) {
|
|
22
|
+
if (fs.existsSync(candidatePath)) {
|
|
23
|
+
eslintConfigPath = candidatePath;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (!eslintConfigPath) {
|
|
28
|
+
console.error('@rushstack/eslint-bulk: Please run this command from the directory that contains one of the following ' +
|
|
29
|
+
`ESLint configuration files: ${ESLINT_CONFIG_FILES.join(', ')}`);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
const env = { ...process.env, _RUSHSTACK_ESLINT_BULK_DETECT: 'true' };
|
|
33
|
+
let eslintPackageJsonPath;
|
|
34
|
+
try {
|
|
35
|
+
eslintPackageJsonPath = require.resolve(`${BULK_SUPPRESSIONS_CLI_ESLINT_PACKAGE_NAME}/package.json`, {
|
|
36
|
+
paths: [process.cwd()]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
if (e.code !== 'MODULE_NOT_FOUND') {
|
|
41
|
+
throw e;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
let eslintBinPath;
|
|
45
|
+
if (eslintPackageJsonPath) {
|
|
46
|
+
eslintPackageJsonPath = eslintPackageJsonPath.replace(/\\/g, '/');
|
|
47
|
+
const packagePath = eslintPackageJsonPath.substring(0, eslintPackageJsonPath.lastIndexOf('/'));
|
|
48
|
+
const { bin: { eslint: relativeEslintBinPath } = {} } = require(eslintPackageJsonPath);
|
|
49
|
+
if (relativeEslintBinPath) {
|
|
50
|
+
eslintBinPath = `${packagePath}/${relativeEslintBinPath}`;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
console.warn(`@rushstack/eslint-bulk: The eslint package resolved at "${packagePath}" does not contain an eslint bin path. ` +
|
|
54
|
+
'Attempting to use a globally-installed eslint instead.');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
console.log('@rushstack/eslint-bulk: Unable to resolve the eslint package as a dependency of the current project. ' +
|
|
59
|
+
'Attempting to use a globally-installed eslint instead.');
|
|
60
|
+
}
|
|
61
|
+
const eslintArgs = ['--stdin', '--config'];
|
|
62
|
+
const spawnOrExecOptions = {
|
|
63
|
+
env,
|
|
64
|
+
input: '',
|
|
65
|
+
stdio: 'pipe'
|
|
66
|
+
};
|
|
67
|
+
let runEslintFn;
|
|
68
|
+
if (eslintBinPath) {
|
|
69
|
+
runEslintFn = () => spawnSync(process.argv0, [eslintBinPath, ...eslintArgs, eslintConfigPath], spawnOrExecOptions).stdout;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Try to use a globally-installed eslint if a local package was not found
|
|
73
|
+
runEslintFn = () => execSync(`eslint ${eslintArgs.join(' ')} "${eslintConfigPath}"`, spawnOrExecOptions);
|
|
74
|
+
}
|
|
75
|
+
let stdout;
|
|
76
|
+
try {
|
|
77
|
+
stdout = runEslintFn();
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
console.error('@rushstack/eslint-bulk: Error finding patch path: ' + e.message);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
const regex = new RegExp(`${ESLINT_BULK_STDOUT_START_DELIMETER}(.*?)${ESLINT_BULK_STDOUT_END_DELIMETER}`);
|
|
84
|
+
const match = stdout.toString().match(regex);
|
|
85
|
+
if (match) {
|
|
86
|
+
// The configuration data will look something like this:
|
|
87
|
+
//
|
|
88
|
+
// RUSHSTACK_ESLINT_BULK_START{"minCliVersion":"0.0.0","cliEntryPoint":"path/to/eslint-bulk.js"}RUSHSTACK_ESLINT_BULK_END
|
|
89
|
+
const configurationJson = match[1].trim();
|
|
90
|
+
let configuration;
|
|
91
|
+
try {
|
|
92
|
+
configuration = JSON.parse(configurationJson);
|
|
93
|
+
if (!configuration.minCliVersion || !configuration.cliEntryPoint) {
|
|
94
|
+
throw new Error('Required field is missing');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
console.error('@rushstack/eslint-bulk: Error parsing patch configuration object:' + e.message);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
const myVersion = require('../package.json').version;
|
|
102
|
+
const myVersionParts = myVersion.split('.').map((x) => parseInt(x, 10));
|
|
103
|
+
const minVersion = configuration.minCliVersion;
|
|
104
|
+
const minVersionParts = minVersion.split('.').map((x) => parseInt(x, 10));
|
|
105
|
+
if (myVersionParts.length !== 3 ||
|
|
106
|
+
minVersionParts.length !== 3 ||
|
|
107
|
+
myVersionParts.some((x) => isNaN(x)) ||
|
|
108
|
+
minVersionParts.some((x) => isNaN(x))) {
|
|
109
|
+
console.error(`@rushstack/eslint-bulk: Unable to compare versions "${myVersion}" and "${minVersion}"`);
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
for (let i = 0; i < 3; ++i) {
|
|
113
|
+
if (myVersionParts[i] > minVersionParts[i]) {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
if (myVersionParts[i] < minVersionParts[i]) {
|
|
117
|
+
console.error(`@rushstack/eslint-bulk: The @rushstack/eslint-bulk version ${myVersion} is too old;` +
|
|
118
|
+
` please upgrade to ${minVersion} or newer.`);
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return configuration.cliEntryPoint;
|
|
123
|
+
}
|
|
124
|
+
console.error('@rushstack/eslint-bulk: Error finding patch path. Are you sure the package you are in has @rushstack/eslint-patch as a direct or indirect dependency?');
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
const patchPath = findPatchPath();
|
|
128
|
+
try {
|
|
129
|
+
require(patchPath);
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
console.error(`@rushstack/eslint-bulk: Error running patch at ${patchPath}:\n` + e.message);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,2DAA2D;;AAE3D,OAAO,EAGL,QAAQ,EACR,SAAS,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,OAAO,MAAM,cAAc,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AAC,KAAK,CACX,uJAAuJ,CACxJ,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,SAAS,GAAW,aAAa,EAAE,CAAC;AAC1C,IAAI,CAAC;IACH,OAAO,CAAC,SAAS,CAAC,CAAC;AACrB,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,OAAO,CAAC,KAAK,CAAC,kDAAkD,SAAS,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;IAC5F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,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 {\n type ExecSyncOptionsWithBufferEncoding,\n type SpawnSyncOptionsWithBufferEncoding,\n execSync,\n spawnSync\n} from 'node:child_process';\nimport * as process from 'node:process';\nimport * as fs from 'node:fs';\n\nimport type {\n ESLINT_BULK_STDOUT_START_DELIMETER as ESLINT_BULK_STDOUT_START_DELIMETER_TYPE,\n ESLINT_BULK_STDOUT_END_DELIMETER as ESLINT_BULK_STDOUT_END_DELIMETER_TYPE,\n ESLINT_PACKAGE_NAME_ENV_VAR_NAME as ESLINT_PACKAGE_NAME_ENV_VAR_NAME_TYPE\n} from '@rushstack/eslint-patch/lib/eslint-bulk-suppressions/constants';\n\nconst ESLINT_BULK_STDOUT_START_DELIMETER: typeof ESLINT_BULK_STDOUT_START_DELIMETER_TYPE =\n 'RUSHSTACK_ESLINT_BULK_START';\nconst ESLINT_BULK_STDOUT_END_DELIMETER: typeof ESLINT_BULK_STDOUT_END_DELIMETER_TYPE =\n 'RUSHSTACK_ESLINT_BULK_END';\nconst ESLINT_PACKAGE_NAME_ENV_VAR_NAME: typeof ESLINT_PACKAGE_NAME_ENV_VAR_NAME_TYPE =\n '_RUSHSTACK_ESLINT_PACKAGE_NAME';\nconst BULK_SUPPRESSIONS_CLI_ESLINT_PACKAGE_NAME: string =\n process.env[ESLINT_PACKAGE_NAME_ENV_VAR_NAME] ?? 'eslint';\n\nconst ESLINT_CONFIG_FILES: string[] = [\n 'eslint.config.js',\n 'eslint.config.cjs',\n 'eslint.config.mjs',\n '.eslintrc.js',\n '.eslintrc.cjs'\n];\n\ninterface IEslintBulkConfigurationJson {\n /**\n * `@rushtack/eslint`-bulk should report an error if its package.json is older than this number\n */\n minCliVersion: string;\n /**\n * `@rushtack/eslint-bulk` will invoke this entry point\n */\n cliEntryPoint: string;\n}\n\nfunction findPatchPath(): string {\n const candidatePaths: string[] = ESLINT_CONFIG_FILES.map((fileName) => `${process.cwd()}/${fileName}`);\n let eslintConfigPath: string | undefined;\n for (const candidatePath of candidatePaths) {\n if (fs.existsSync(candidatePath)) {\n eslintConfigPath = candidatePath;\n break;\n }\n }\n\n if (!eslintConfigPath) {\n console.error(\n '@rushstack/eslint-bulk: Please run this command from the directory that contains one of the following ' +\n `ESLint configuration files: ${ESLINT_CONFIG_FILES.join(', ')}`\n );\n process.exit(1);\n }\n\n const env: NodeJS.ProcessEnv = { ...process.env, _RUSHSTACK_ESLINT_BULK_DETECT: 'true' };\n\n let eslintPackageJsonPath: string | undefined;\n try {\n eslintPackageJsonPath = require.resolve(`${BULK_SUPPRESSIONS_CLI_ESLINT_PACKAGE_NAME}/package.json`, {\n paths: [process.cwd()]\n });\n } catch (e) {\n if (e.code !== 'MODULE_NOT_FOUND') {\n throw e;\n }\n }\n\n let eslintBinPath: string | undefined;\n if (eslintPackageJsonPath) {\n eslintPackageJsonPath = eslintPackageJsonPath.replace(/\\\\/g, '/');\n const packagePath: string = eslintPackageJsonPath.substring(0, eslintPackageJsonPath.lastIndexOf('/'));\n const { bin: { eslint: relativeEslintBinPath } = {} }: { bin?: Record<string, string> } = require(\n eslintPackageJsonPath\n );\n if (relativeEslintBinPath) {\n eslintBinPath = `${packagePath}/${relativeEslintBinPath}`;\n } else {\n console.warn(\n `@rushstack/eslint-bulk: The eslint package resolved at \"${packagePath}\" does not contain an eslint bin path. ` +\n 'Attempting to use a globally-installed eslint instead.'\n );\n }\n } else {\n console.log(\n '@rushstack/eslint-bulk: Unable to resolve the eslint package as a dependency of the current project. ' +\n 'Attempting to use a globally-installed eslint instead.'\n );\n }\n\n const eslintArgs: string[] = ['--stdin', '--config'];\n const spawnOrExecOptions: SpawnSyncOptionsWithBufferEncoding & ExecSyncOptionsWithBufferEncoding = {\n env,\n input: '',\n stdio: 'pipe'\n };\n let runEslintFn: () => Buffer;\n if (eslintBinPath) {\n runEslintFn = () =>\n spawnSync(process.argv0, [eslintBinPath, ...eslintArgs, eslintConfigPath], spawnOrExecOptions).stdout;\n } else {\n // Try to use a globally-installed eslint if a local package was not found\n runEslintFn = () => execSync(`eslint ${eslintArgs.join(' ')} \"${eslintConfigPath}\"`, spawnOrExecOptions);\n }\n\n let stdout: Buffer;\n try {\n stdout = runEslintFn();\n } catch (e) {\n console.error('@rushstack/eslint-bulk: Error finding patch path: ' + e.message);\n process.exit(1);\n }\n\n const regex: RegExp = new RegExp(\n `${ESLINT_BULK_STDOUT_START_DELIMETER}(.*?)${ESLINT_BULK_STDOUT_END_DELIMETER}`\n );\n const match: RegExpMatchArray | null = stdout.toString().match(regex);\n\n if (match) {\n // The configuration data will look something like this:\n //\n // RUSHSTACK_ESLINT_BULK_START{\"minCliVersion\":\"0.0.0\",\"cliEntryPoint\":\"path/to/eslint-bulk.js\"}RUSHSTACK_ESLINT_BULK_END\n const configurationJson: string = match[1].trim();\n let configuration: IEslintBulkConfigurationJson;\n try {\n configuration = JSON.parse(configurationJson);\n if (!configuration.minCliVersion || !configuration.cliEntryPoint) {\n throw new Error('Required field is missing');\n }\n } catch (e) {\n console.error('@rushstack/eslint-bulk: Error parsing patch configuration object:' + e.message);\n process.exit(1);\n }\n\n const myVersion: string = require('../package.json').version;\n const myVersionParts: number[] = myVersion.split('.').map((x) => parseInt(x, 10));\n const minVersion: string = configuration.minCliVersion;\n const minVersionParts: number[] = minVersion.split('.').map((x) => parseInt(x, 10));\n if (\n myVersionParts.length !== 3 ||\n minVersionParts.length !== 3 ||\n myVersionParts.some((x) => isNaN(x)) ||\n minVersionParts.some((x) => isNaN(x))\n ) {\n console.error(`@rushstack/eslint-bulk: Unable to compare versions \"${myVersion}\" and \"${minVersion}\"`);\n process.exit(1);\n }\n\n for (let i: number = 0; i < 3; ++i) {\n if (myVersionParts[i] > minVersionParts[i]) {\n break;\n }\n if (myVersionParts[i] < minVersionParts[i]) {\n console.error(\n `@rushstack/eslint-bulk: The @rushstack/eslint-bulk version ${myVersion} is too old;` +\n ` please upgrade to ${minVersion} or newer.`\n );\n process.exit(1);\n }\n }\n\n return configuration.cliEntryPoint;\n }\n\n console.error(\n '@rushstack/eslint-bulk: Error finding patch path. Are you sure the package you are in has @rushstack/eslint-patch as a direct or indirect dependency?'\n );\n process.exit(1);\n}\n\nconst patchPath: string = findPatchPath();\ntry {\n require(patchPath);\n} catch (e) {\n console.error(`@rushstack/eslint-bulk: Error running patch at ${patchPath}:\\n` + e.message);\n process.exit(1);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/eslint-bulk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Roll out new ESLint rules in a large monorepo without cluttering up your code with \"eslint-ignore-next-line\"",
|
|
5
|
-
"
|
|
5
|
+
"exports": {
|
|
6
|
+
"./lib/*": {
|
|
7
|
+
"types": "./lib-dts/*.d.ts",
|
|
8
|
+
"node": "./lib-commonjs/*.js",
|
|
9
|
+
"import": "./lib-esm/*.js",
|
|
10
|
+
"require": "./lib-commonjs/*.js"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"typesVersions": {
|
|
15
|
+
"*": {
|
|
16
|
+
"lib/*": [
|
|
17
|
+
"lib-dts/*"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
6
21
|
"license": "MIT",
|
|
7
22
|
"repository": {
|
|
8
23
|
"url": "https://github.com/microsoft/rushstack.git",
|
|
@@ -28,13 +43,17 @@
|
|
|
28
43
|
"devDependencies": {
|
|
29
44
|
"@types/node": "20.17.19",
|
|
30
45
|
"eslint": "~9.37.0",
|
|
31
|
-
"@rushstack/eslint-patch": "1.
|
|
32
|
-
"
|
|
33
|
-
"
|
|
46
|
+
"@rushstack/eslint-patch": "1.16.1",
|
|
47
|
+
"@rushstack/heft": "1.2.1",
|
|
48
|
+
"local-node-rig": "1.0.0"
|
|
34
49
|
},
|
|
50
|
+
"sideEffects": [
|
|
51
|
+
"lib-commonjs/start.js",
|
|
52
|
+
"lib-esm/start.js"
|
|
53
|
+
],
|
|
35
54
|
"scripts": {
|
|
36
55
|
"build": "heft build --clean",
|
|
37
56
|
"_phase:build": "heft run --only build -- --clean",
|
|
38
|
-
"start": "node ./lib/start.js"
|
|
57
|
+
"start": "node ./lib-commonjs/start.js"
|
|
39
58
|
}
|
|
40
59
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|