Skip to content

Commit 44cf02b

Browse files
authored
Merge pull request #129 from gadget-inc/esm-support-2
ESM
2 parents 7f398a1 + 9c6eecf commit 44cf02b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1973
-2731
lines changed

.eslintrc.cjs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module.exports = {
2+
extends: "@gadgetinc/eslint-config",
3+
parserOptions: {
4+
tsconfigRootDir: __dirname,
5+
project: ["./tsconfig.test.json"],
6+
},
7+
ignorePatterns: [".eslintrc.cjs", "spec/fixtures/**/*"],
8+
rules: {
9+
"lodash/import-scope": "off",
10+
// Disable all Jest-related ESLint rules
11+
"jest/no-alias-methods": "off",
12+
"jest/no-commented-out-tests": "off",
13+
"jest/no-conditional-expect": "off",
14+
"jest/no-deprecated-functions": "off",
15+
"jest/no-disabled-tests": "off",
16+
"jest/no-done-callback": "off",
17+
"jest/no-duplicate-hooks": "off",
18+
"jest/no-export": "off",
19+
"jest/no-focused-tests": "off",
20+
"jest/no-hooks": "off",
21+
"jest/no-identical-title": "off",
22+
"jest/no-if": "off",
23+
"jest/no-interpolation-in-snapshots": "off",
24+
"jest/no-jasmine-globals": "off",
25+
"jest/no-jest-import": "off",
26+
"jest/no-large-snapshots": "off",
27+
"jest/no-mocks-import": "off",
28+
"jest/no-restricted-matchers": "off",
29+
"jest/no-standalone-expect": "off",
30+
"jest/no-test-prefixes": "off",
31+
"jest/no-test-return-statement": "off",
32+
"jest/prefer-called-with": "off",
33+
"jest/prefer-expect-assertions": "off",
34+
"jest/prefer-hooks-on-top": "off",
35+
"jest/prefer-spy-on": "off",
36+
"jest/prefer-strict-equal": "off",
37+
"jest/prefer-to-be": "off",
38+
"jest/prefer-to-contain": "off",
39+
"jest/prefer-to-have-length": "off",
40+
"jest/prefer-todo": "off",
41+
"jest/require-to-throw-message": "off",
42+
"jest/require-top-level-describe": "off",
43+
"jest/valid-describe-callback": "off",
44+
"jest/valid-expect": "off",
45+
"jest/valid-expect-in-promise": "off",
46+
"jest/valid-title": "off"
47+
},
48+
};

.eslintrc.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
- uses: actions/checkout@v2
1414
- uses: ./.github/actions/setup-test-env
1515
- run: pnpm build
16-
- run: integration-test/test.sh
17-
- run: pnpm jest
16+
- run: pnpm zx integration-test/test.js
17+
- run: pnpm test
1818

1919
lint:
2020
runs-on: ubuntu-latest

.swcrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"target": "esnext"
1010
},
1111
"module": {
12-
"type": "commonjs",
13-
"lazy": true
12+
"type": "es6"
1413
}
1514
}

Readme.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ wds --inspect some-test.test.ts
2323

2424
- Builds and runs TypeScript really fast using [`swc`](https://github.com/swc-project/swc)
2525
- Incrementally rebuilds only what has changed in `--watch` mode, restarting the process on file changes
26+
- Full support for CommonJS and ESM packages (subject to node's own interoperability rules)
2627
- Execute commands on demand with the `--commands` mode
2728
- Plays nice with node.js command line flags like `--inspect` or `--prof`
2829
- Supports node.js `ipc` channels between the process starting `wds` and the node.js process started by `wds`.
@@ -70,7 +71,7 @@ module.exports = {
7071

7172
`swc` is the fastest TypeScript compiler we've found and is the default compiler `wds` uses. `wds` sets up a default `swc` config suitable for compiling to JS for running in Node:
7273

73-
```json
74+
```jsonc
7475
{
7576
"jsc": {
7677
"parser": {
@@ -116,7 +117,7 @@ module.exports = {
116117

117118
And then, you can use `swc`'s standard syntax for the `.swcrc` file
118119

119-
```json
120+
```jsonc
120121
// in .swcrc, these are the defaults wds uses
121122
{
122123
"jsc": {

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
packages =
2222
rec {
2323
bash = pkgs.bash;
24-
nodejs = pkgs.nodejs_20;
24+
nodejs = pkgs.nodejs_22;
2525
corepack = pkgs.corepack;
2626
};
2727

gitpkg.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const { execSync } = require('child_process')
1+
import { execSync } from "child_process";
22

3-
module.exports = () => ({
3+
export default () => ({
44
getTagName: (pkg) =>
55
`${pkg.name}-v${pkg.version}-gitpkg-${execSync(
66
'git rev-parse --short HEAD',
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"jsc": {
3+
"parser": {
4+
"syntax": "typescript",
5+
"tsx": true,
6+
"decorators": true,
7+
"dynamicImport": true
8+
},
9+
"target": "esnext"
10+
},
11+
"module": {
12+
"type": "commonjs"
13+
}
14+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "cjs-js-from-ts",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"type": "commonjs",
7+
"scripts": {
8+
"test": "echo \"Error: no test specified\" && exit 1"
9+
},
10+
"license": "ISC"
11+
}

0 commit comments

Comments
 (0)