mirror of https://github.com/facebook/jest.git
fix: add ESM exports of all modules manually (#14661)
This commit is contained in:
parent
f99213dd7f
commit
79a4ff4985
|
@ -35,13 +35,14 @@
|
||||||
|
|
||||||
### Performance
|
### Performance
|
||||||
|
|
||||||
- `[*]` [**BREAKING**] Bundle all of Jest's modules into `index.js` ([#12348](https://github.com/jestjs/jest/pull/12348) & [#14550](https://github.com/jestjs/jest/pull/14550))
|
- `[*]` [**BREAKING**] Bundle all of Jest's modules into `index.js` ([#12348](https://github.com/jestjs/jest/pull/12348), [#14550](https://github.com/jestjs/jest/pull/14550) & [#14661](https://github.com/jestjs/jest/pull/14661))
|
||||||
|
|
||||||
### Chore & Maintenance
|
### Chore & Maintenance
|
||||||
|
|
||||||
- `[*]` [**BREAKING**] Drop support for Node.js versions 14 and 19 ([#14460](https://github.com/jestjs/jest/pull/14460))
|
- `[*]` [**BREAKING**] Drop support for Node.js versions 14 and 19 ([#14460](https://github.com/jestjs/jest/pull/14460))
|
||||||
- `[*]` [**BREAKING**] Drop support for `typescript@4.3`, minimum version is now `5.0` ([#14542](https://github.com/facebook/jest/pull/14542))
|
- `[*]` [**BREAKING**] Drop support for `typescript@4.3`, minimum version is now `5.0` ([#14542](https://github.com/facebook/jest/pull/14542))
|
||||||
- `[*]` Depend on exact versions of monorepo dependencies instead of `^` range ([#14553](https://github.com/facebook/jest/pull/14553))
|
- `[*]` Depend on exact versions of monorepo dependencies instead of `^` range ([#14553](https://github.com/facebook/jest/pull/14553))
|
||||||
|
- `[*]` [**BREAKING**] Add ESM wrapper for all of Jest's modules ([#14661](https://github.com/jestjs/jest/pull/14661))
|
||||||
- `[babel-jest, babel-preset-jest]` [**BREAKING**] Increase peer dependency of `@babel/core` to `^7.11` ([#14109](https://github.com/jestjs/jest/pull/14109))
|
- `[babel-jest, babel-preset-jest]` [**BREAKING**] Increase peer dependency of `@babel/core` to `^7.11` ([#14109](https://github.com/jestjs/jest/pull/14109))
|
||||||
- `[jest-cli, jest-config, @jest/types]` [**BREAKING**] Remove deprecated `--init` argument ([#14490](https://github.com/jestjs/jest/pull/14490))
|
- `[jest-cli, jest-config, @jest/types]` [**BREAKING**] Remove deprecated `--init` argument ([#14490](https://github.com/jestjs/jest/pull/14490))
|
||||||
- `[docs]` Fix typos in `CHANGELOG.md` and `packages/jest-validate/README.md` ([#14640](https://github.com/jestjs/jest/pull/14640))
|
- `[docs]` Fix typos in `CHANGELOG.md` and `packages/jest-validate/README.md` ([#14640](https://github.com/jestjs/jest/pull/14640))
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Sequencer from '@jest/test-sequencer';
|
import Sequencer from '@jest/test-sequencer';
|
||||||
|
|
||||||
export default class CustomSequencer extends Sequencer.default {
|
export default class CustomSequencer extends Sequencer {
|
||||||
sort(tests) {
|
sort(tests) {
|
||||||
const copyTests = Array.from(tests);
|
const copyTests = Array.from(tests);
|
||||||
return copyTests.sort((testA, testB) => (testA.path > testB.path ? 1 : -1));
|
return copyTests.sort((testA, testB) => (testA.path > testB.path ? 1 : -1));
|
||||||
|
|
|
@ -8,9 +8,7 @@ import * as crypto from 'crypto';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import fs from 'graceful-fs';
|
import fs from 'graceful-fs';
|
||||||
import jestUtil from 'jest-util';
|
import {createDirectory} from 'jest-util';
|
||||||
|
|
||||||
const {createDirectory} = jestUtil;
|
|
||||||
|
|
||||||
const DIR = path.join(os.tmpdir(), 'jest-global-setup-esm');
|
const DIR = path.join(os.tmpdir(), 'jest-global-setup-esm');
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,7 @@ import * as crypto from 'crypto';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import fs from 'graceful-fs';
|
import fs from 'graceful-fs';
|
||||||
import jestUtil from 'jest-util';
|
import {createDirectory} from 'jest-util';
|
||||||
|
|
||||||
const {createDirectory} = jestUtil;
|
|
||||||
|
|
||||||
const DIR = path.join(os.tmpdir(), 'jest-global-teardown-esm');
|
const DIR = path.join(os.tmpdir(), 'jest-global-teardown-esm');
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import testResult from '@jest/test-result';
|
import {createEmptyTestResult} from '@jest/test-result';
|
||||||
|
|
||||||
const {createEmptyTestResult} = testResult;
|
|
||||||
|
|
||||||
export default class BaseTestRunner {
|
export default class BaseTestRunner {
|
||||||
constructor(globalConfig, context) {
|
constructor(globalConfig, context) {
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
import testResult from '@jest/test-result';
|
|
||||||
|
|
||||||
const {createEmptyTestResult} = testResult;
|
import {createEmptyTestResult} from '@jest/test-result';
|
||||||
|
|
||||||
export default async function testRunner(
|
export default async function testRunner(
|
||||||
globalConfig,
|
globalConfig,
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
"rimraf": "^5.0.0",
|
"rimraf": "^5.0.0",
|
||||||
"semver": "^7.5.3",
|
"semver": "^7.5.3",
|
||||||
"slash": "^3.0.0",
|
"slash": "^3.0.0",
|
||||||
"string-length": "^4.0.1",
|
|
||||||
"strip-ansi": "^6.0.0",
|
"strip-ansi": "^6.0.0",
|
||||||
"strip-json-comments": "^3.1.1",
|
"strip-json-comments": "^3.1.1",
|
||||||
"tempy": "^1.0.0",
|
"tempy": "^1.0.0",
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json",
|
"./package.json": "./package.json",
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json",
|
"./package.json": "./package.json",
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json",
|
"./package.json": "./package.json",
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json",
|
"./package.json": "./package.json",
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json",
|
"./package.json": "./package.json",
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json",
|
"./package.json": "./package.json",
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./build/index.d.ts",
|
"types": "./build/index.d.ts",
|
||||||
|
"require": "./build/index.js",
|
||||||
|
"import": "./build/index.mjs",
|
||||||
"default": "./build/index.js"
|
"default": "./build/index.js"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {strict as assert} from 'assert';
|
import {strict as assert} from 'assert';
|
||||||
|
import {createRequire} from 'module';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import util from 'util';
|
import util from 'util';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
|
import dedent from 'dedent';
|
||||||
import fs from 'graceful-fs';
|
import fs from 'graceful-fs';
|
||||||
import webpack from 'webpack';
|
import webpack from 'webpack';
|
||||||
import {
|
import {
|
||||||
|
@ -16,8 +18,11 @@ import {
|
||||||
OK,
|
OK,
|
||||||
createBuildConfigs,
|
createBuildConfigs,
|
||||||
createWebpackConfigs,
|
createWebpackConfigs,
|
||||||
|
typeOnlyPackages,
|
||||||
} from './buildUtils.mjs';
|
} from './buildUtils.mjs';
|
||||||
|
|
||||||
|
const require = createRequire(import.meta.url);
|
||||||
|
|
||||||
async function buildNodePackages() {
|
async function buildNodePackages() {
|
||||||
process.stdout.write(chalk.inverse(' Bundling packages \n'));
|
process.stdout.write(chalk.inverse(' Bundling packages \n'));
|
||||||
|
|
||||||
|
@ -49,10 +54,40 @@ async function buildNodePackages() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const {packageDir, pkg} of buildConfigs) {
|
for (const {packageDir, pkg} of buildConfigs) {
|
||||||
|
const entryPointFile = path.resolve(packageDir, pkg.main);
|
||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
fs.existsSync(path.resolve(packageDir, pkg.main)),
|
fs.existsSync(entryPointFile),
|
||||||
`Main file "${pkg.main}" in "${pkg.name}" should exist`,
|
`Main file "${pkg.main}" in "${pkg.name}" should exist`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (typeOnlyPackages.has(pkg.name)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: can we get exports from a file from webpack's `stats`?
|
||||||
|
const cjsModule = require(entryPointFile);
|
||||||
|
const exportStatements = Object.keys(cjsModule)
|
||||||
|
.filter(name => name !== '__esModule' && name !== 'default')
|
||||||
|
.map(name => `export const ${name} = cjsModule.${name};`);
|
||||||
|
|
||||||
|
if (cjsModule.default) {
|
||||||
|
exportStatements.push('export default cjsModule.default;');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exportStatements.length === 0) {
|
||||||
|
throw new Error(`No exports found in package ${pkg.name}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const mjsEntryFile = entryPointFile.replace(/\.js$/, '.mjs');
|
||||||
|
|
||||||
|
const esSource = dedent`
|
||||||
|
import cjsModule from './index.js';
|
||||||
|
|
||||||
|
${exportStatements.join('\n')}
|
||||||
|
`;
|
||||||
|
|
||||||
|
await fs.promises.writeFile(mjsEntryFile, `${esSource}\n`);
|
||||||
}
|
}
|
||||||
|
|
||||||
process.stdout.write(`${OK}\n`);
|
process.stdout.write(`${OK}\n`);
|
||||||
|
|
|
@ -12,7 +12,6 @@ import {fileURLToPath} from 'url';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import fs from 'graceful-fs';
|
import fs from 'graceful-fs';
|
||||||
import {sync as readPkg} from 'read-pkg';
|
import {sync as readPkg} from 'read-pkg';
|
||||||
import stringLength from 'string-length';
|
|
||||||
import webpack from 'webpack';
|
import webpack from 'webpack';
|
||||||
import nodeExternals from 'webpack-node-externals';
|
import nodeExternals from 'webpack-node-externals';
|
||||||
import babelConfig from '../babel.config.js';
|
import babelConfig from '../babel.config.js';
|
||||||
|
@ -26,6 +25,14 @@ const require = createRequire(import.meta.url);
|
||||||
export const OK = chalk.reset.inverse.bold.green(' DONE ');
|
export const OK = chalk.reset.inverse.bold.green(' DONE ');
|
||||||
export const ERROR = chalk.reset.inverse.bold.red(' BOOM ');
|
export const ERROR = chalk.reset.inverse.bold.red(' BOOM ');
|
||||||
|
|
||||||
|
export const typeOnlyPackages = new Set([
|
||||||
|
'babel-preset-jest',
|
||||||
|
'@jest/environment',
|
||||||
|
'@jest/globals',
|
||||||
|
'@jest/types',
|
||||||
|
'@jest/test-globals',
|
||||||
|
]);
|
||||||
|
|
||||||
// Get absolute paths of all directories under packages/*
|
// Get absolute paths of all directories under packages/*
|
||||||
export function getPackages() {
|
export function getPackages() {
|
||||||
const packages = fs
|
const packages = fs
|
||||||
|
@ -58,11 +65,19 @@ export function getPackages() {
|
||||||
'.':
|
'.':
|
||||||
pkg.types == null
|
pkg.types == null
|
||||||
? pkg.main
|
? pkg.main
|
||||||
|
: typeOnlyPackages.has(pkg.name)
|
||||||
|
? /* eslint-disable sort-keys */
|
||||||
|
{
|
||||||
|
types: pkg.types,
|
||||||
|
default: pkg.main,
|
||||||
|
}
|
||||||
: {
|
: {
|
||||||
types: pkg.types,
|
types: pkg.types,
|
||||||
// eslint-disable-next-line sort-keys
|
require: pkg.main,
|
||||||
|
import: pkg.main.replace(/\.js$/, '.mjs'),
|
||||||
default: pkg.main,
|
default: pkg.main,
|
||||||
},
|
},
|
||||||
|
/* eslint-enable */
|
||||||
'./package.json': './package.json',
|
'./package.json': './package.json',
|
||||||
...Object.values(pkg.bin || {}).reduce(
|
...Object.values(pkg.bin || {}).reduce(
|
||||||
(mem, curr) =>
|
(mem, curr) =>
|
||||||
|
@ -117,17 +132,6 @@ export function getPackages() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function adjustToTerminalWidth(str) {
|
|
||||||
const columns = process.stdout.columns || 80;
|
|
||||||
const WIDTH = columns - stringLength(OK) + 1;
|
|
||||||
const strs = str.match(new RegExp(`(.{1,${WIDTH}})`, 'g'));
|
|
||||||
let lastString = strs[strs.length - 1];
|
|
||||||
if (lastString.length < WIDTH) {
|
|
||||||
lastString += Array(WIDTH - lastString.length).join(chalk.dim('.'));
|
|
||||||
}
|
|
||||||
return strs.slice(0, -1).concat(lastString).join('\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getPackagesWithTsConfig() {
|
export function getPackagesWithTsConfig() {
|
||||||
return getPackages().filter(p =>
|
return getPackages().filter(p =>
|
||||||
fs.existsSync(path.resolve(p.packageDir, 'tsconfig.json')),
|
fs.existsSync(path.resolve(p.packageDir, 'tsconfig.json')),
|
||||||
|
|
Loading…
Reference in New Issue