Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deps fix #685

Merged
merged 3 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: |
npm install -g corepack
corepack enable
pnpm install
pnpm install -r

- name: Build TypeScript
run: pnpm build
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,38 @@
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/plugin-transform-typescript": "^7.20.7",
"@babel/plugin-transform-typescript": "^7.20.13",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@swc-node/core": "workspace:*",
"@swc-node/jest": "workspace:*",
"@swc-node/register": "workspace:*",
"@types/babel__core": "^7.1.20",
"@types/babel__core": "^7.20.0",
"@types/benchmark": "^2.1.2",
"@types/lodash": "^4.14.191",
"@types/node": "^18.11.18",
"@types/node": "^18.11.19",
"@types/sinon": "^10.0.13",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"ava": "^5.1.0",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"ava": "^5.2.0",
"benchmark": "^2.1.4",
"colorette": "^2.0.19",
"esbuild": "^0.16.14",
"eslint": "^8.31.0",
"esbuild": "^0.17.6",
"eslint": "^8.33.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"jest": "^29.3.1",
"lerna": "^6.3.0",
"jest": "^29.4.1",
"lerna": "^6.4.1",
"lint-staged": "^13.1.0",
"lodash": "^4.17.21",
"prettier": "^2.8.1",
"prettier": "^2.8.3",
"react": "^18.2.0",
"rxjs": "^7.8.0",
"sinon": "^15.0.1",
"tslib": "^2.4.1",
"typescript": "^4.9.4"
"tslib": "^2.5.0",
"typescript": "^4.9.5"
},
"lint-staged": {
"*.@(js|ts|tsx)": ["prettier --write"],
Expand All @@ -88,5 +88,5 @@
"SWC_NODE_PROJECT": "./tsconfig.test.json"
}
},
"packageManager": "pnpm@7.22.0"
"packageManager": "pnpm@7.26.3"
}
8 changes: 4 additions & 4 deletions packages/integrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"url": "https://github.com/swc-project/swc-node/issues"
},
"devDependencies": {
"@swc-node/core": "^1.9.1",
"@types/jest": "^29.2.5",
"@types/react": "^18.0.26",
"@swc-node/core": "^1.9.2",
"@types/jest": "^29.4.0",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"jest": "^29.3.1",
"jest": "^29.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sinon": "^15.0.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { xxh64 } from '@node-rs/xxhash'
import type { Output } from '@swc/core'
import { Options, transformJest } from '@swc-node/core'
import { readDefaultTsConfig, tsCompilerOptionsToSwcConfig } from '@swc-node/register/read-default-tsconfig'
import type { Output } from '@swc/core'

interface JestConfig26 {
transform: [match: string, transformerPath: string, options: Options][]
Expand Down
2 changes: 1 addition & 1 deletion packages/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"access": "public"
},
"dependencies": {
"@node-rs/xxhash": "^1.2.1",
"@node-rs/xxhash": "^1.3.0",
"@swc-node/core": "^1.9.2",
"@swc-node/register": "^1.5.5"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"url": "https://github.com/sponsors/Brooooooklyn"
},
"devDependencies": {
"typescript": "^4.9.4",
"typescript": "^4.9.5",
"webpack": "^5.75.0"
}
}
6 changes: 3 additions & 3 deletions packages/register/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@
"colorette": "^2.0.19",
"debug": "^4.3.4",
"pirates": "^4.0.5",
"tslib": "^2.4.1"
"tslib": "^2.5.0"
},
"peerDependencies": {
"@swc/core": ">= 1.3",
"typescript": ">= 4.3"
},
"devDependencies": {
"@swc/core": "^1.3.24",
"@swc/core": "^1.3.32",
"@types/debug": "^4.1.7",
"lodash": "^4.17.21",
"sinon": "^15.0.1",
"typescript": "^4.9.4"
"typescript": "^4.9.5"
},
"funding": {
"type": "github",
Expand Down
33 changes: 23 additions & 10 deletions packages/register/read-default-tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,11 @@ export function createSourcemapOption(options: ts.CompilerOptions) {
}

export function tsCompilerOptionsToSwcConfig(options: ts.CompilerOptions, filename: string): Options {
const isJsx = filename.endsWith('.tsx') || filename.endsWith('.jsx') || Boolean(options.jsx)
return {
target: toTsTarget(options.target ?? ts.ScriptTarget.ES2018),
module: toModule(options.module ?? ts.ModuleKind.ES2015),
sourcemap: createSourcemapOption(options),
jsx: filename.endsWith('.tsx') || filename.endsWith('.jsx') || Boolean(options.jsx),
react:
options.jsxFactory || options.jsxFragmentFactory || options.jsx || options.jsxImportSource
? {
pragma: options.jsxFactory,
pragmaFrag: options.jsxFragmentFactory,
importSource: options.jsxImportSource,
runtime: (options.jsx ?? 0) >= ts.JsxEmit.ReactJSX ? 'automatic' : 'classic',
}
: undefined,
experimentalDecorators: options.experimentalDecorators ?? false,
emitDecoratorMetadata: options.emitDecoratorMetadata ?? false,
dynamicImport: true,
Expand All @@ -132,5 +123,27 @@ export function tsCompilerOptionsToSwcConfig(options: ts.CompilerOptions, filena
((aliasPaths as string[]) ?? []).map((path) => resolve(options.baseUrl ?? './', path)),
]),
) as Options['paths'],
swc: {
filename,
jsc: {
externalHelpers: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this void the change from #673 - this was added to resolve an issue with our test coverage

parser: {
syntax: 'typescript',
tsx: isJsx,
},
transform: {
react:
options.jsxFactory || options.jsxFragmentFactory || options.jsx || options.jsxImportSource
? {
pragma: options.jsxFactory,
pragmaFrag: options.jsxFragmentFactory,
importSource: options.jsxImportSource ?? 'react',
runtime: (options.jsx ?? 0) >= ts.JsxEmit.ReactJSX ? 'automatic' : 'classic',
useBuiltins: true,
}
: undefined,
},
},
},
}
}
2 changes: 1 addition & 1 deletion packages/sourcemap-support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"source-map-support": "^0.5.21",
"tslib": "^2.4.1"
"tslib": "^2.5.0"
},
"bugs": {
"url": "https://github.com/swc-project/swc-node/issues"
Expand Down