From 662ee5e1bdf100599f06257ee21556d4c6d1dd78 Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Tue, 2 Jan 2024 16:23:54 +0100 Subject: [PATCH 1/3] fix: try tsx last --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index b951fd9..22f9ed4 100644 --- a/index.js +++ b/index.js @@ -401,6 +401,7 @@ var extensions = { ); }, }, + 'tsx/dist/esm/index.cjs', { module: '@swc/register', register: function (hook, config) { @@ -498,6 +499,7 @@ var extensions = { ); }, }, + 'tsx/dist/esm/index.cjs', ], '.yaml': 'yaml-hook/register', '.yml': 'yaml-hook/register', From 73f53d2d62654370aef38cad46ca35f270bba5e5 Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Tue, 2 Jan 2024 17:27:17 +0100 Subject: [PATCH 2/3] tests(tsx): add tests --- index.js | 4 ++-- test/fixtures/ts/5/package.json | 5 +++++ test/fixtures/ts/5/test.ts | 15 +++++++++++++++ test/fixtures/tsx/5/data.tsx | 13 +++++++++++++ test/fixtures/tsx/5/package.json | 5 +++++ test/fixtures/tsx/5/test.tsx | 11 +++++++++++ test/index.js | 1 + 7 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/ts/5/package.json create mode 100644 test/fixtures/ts/5/test.ts create mode 100644 test/fixtures/tsx/5/data.tsx create mode 100644 test/fixtures/tsx/5/package.json create mode 100644 test/fixtures/tsx/5/test.tsx diff --git a/index.js b/index.js index 22f9ed4..2665609 100644 --- a/index.js +++ b/index.js @@ -401,7 +401,6 @@ var extensions = { ); }, }, - 'tsx/dist/esm/index.cjs', { module: '@swc/register', register: function (hook, config) { @@ -425,6 +424,7 @@ var extensions = { ); }, }, + 'tsx/dist/cjs/index.cjs', ], '.cts': ['ts-node/register'], '.tsx': [ @@ -499,7 +499,7 @@ var extensions = { ); }, }, - 'tsx/dist/esm/index.cjs', + 'tsx/dist/cjs/index.cjs', ], '.yaml': 'yaml-hook/register', '.yml': 'yaml-hook/register', diff --git a/test/fixtures/ts/5/package.json b/test/fixtures/ts/5/package.json new file mode 100644 index 0000000..a5757e8 --- /dev/null +++ b/test/fixtures/ts/5/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "tsx": "^4.7.0" + } +} diff --git a/test/fixtures/ts/5/test.ts b/test/fixtures/ts/5/test.ts new file mode 100644 index 0000000..06c3cc0 --- /dev/null +++ b/test/fixtures/ts/5/test.ts @@ -0,0 +1,15 @@ +var test = { + data: { + trueKey: true, + falseKey: false, + subKey: { + subProp: 1, + }, + }, +}; + +var main = { + default: test, +}; + +export = main; \ No newline at end of file diff --git a/test/fixtures/tsx/5/data.tsx b/test/fixtures/tsx/5/data.tsx new file mode 100644 index 0000000..e2f8fab --- /dev/null +++ b/test/fixtures/tsx/5/data.tsx @@ -0,0 +1,13 @@ +export const data: { + trueKey: boolean + falseKey: boolean + subKey: { + subProp: number + } +} = { + trueKey: true, + falseKey: false, + subKey: { + subProp: 1 + } +} diff --git a/test/fixtures/tsx/5/package.json b/test/fixtures/tsx/5/package.json new file mode 100644 index 0000000..a5757e8 --- /dev/null +++ b/test/fixtures/tsx/5/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "tsx": "^4.7.0" + } +} diff --git a/test/fixtures/tsx/5/test.tsx b/test/fixtures/tsx/5/test.tsx new file mode 100644 index 0000000..da694b8 --- /dev/null +++ b/test/fixtures/tsx/5/test.tsx @@ -0,0 +1,11 @@ +/** @jsx jsx */ + +import { data } from './data' + +const Component = (props: object) => ({ data: props }) + +function jsx (element: typeof Component, props: object) { + return element(props) +} + +export default diff --git a/test/index.js b/test/index.js index 1f9ca83..e7c0d49 100644 --- a/test/index.js +++ b/test/index.js @@ -135,6 +135,7 @@ describe('interpret.extensions', function () { this.skip(); } + // if (name === '') this.timeout(0); var expected; From c14f0c8980895467c5909af5273d6032d94f98b7 Mon Sep 17 00:00:00 2001 From: Even Stensberg Date: Mon, 8 Jul 2024 17:09:57 +0200 Subject: [PATCH 3/3] chore(package.json): add me to contributors --- package.json | 3 ++- test/index.js | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 14027ee..6611bc7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "author": "Gulp Team (https://gulpjs.com/)", "contributors": [ "Blaine Bublitz ", - "Tyler Kellen (http://goingslowly.com/)" + "Tyler Kellen (http://goingslowly.com/)", + "Even Stensberg " ], "repository": "gulpjs/interpret", "license": "MIT", diff --git a/test/index.js b/test/index.js index e7c0d49..a34e9a3 100644 --- a/test/index.js +++ b/test/index.js @@ -129,7 +129,6 @@ describe('interpret.extensions', function () { this.skip(); } } - // Skip any swc test on linux due to https://github.com/swc-project/swc/issues/4107 if (name === '@swc/register' && process.platform === 'linux') { this.skip();