From 18a0319c0d53c4c33a8ce9badca4d6cfe98cb314 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 6 Apr 2022 17:31:07 -0700 Subject: [PATCH] chore!: Drop legacy loaders & extensions (#79) chore!: Remove legacy node-jsx hook chore!: Remove deprecated typescript-node hook chore!: Remove deprecated typescript-register hook chore!: Remove unmaintained typescript-require hook chore!: Replace legacy require-yaml with yaml-hook chore!: Remove legacy require-xml support chore!: Remove legacy/deprecated babel hooks chore!: Remove legacy buble support chore!: Remove legacy cirru-script support chore!: Remove legacy node-cjsx support chore!: Remove legacy coco support chore!: Remove legacy/deprecated coffeescript hooks chore!: Remove legacy require-csv support chore!: Remove legacy earlgrey support chore!: Remove legacy iced-coffee-script support chore!: Remove legacy require-ini support chore!: Remove legacy json5 hook chore!: Remove legacy livescript support chore!: Remove legacy wisp support --- README.md | 129 ++++---------------- index.js | 144 ++++------------------- package.json | 15 --- test/fixtures/babel.js/1/.babelrc | 3 - test/fixtures/babel.js/1/package.json | 6 - test/fixtures/babel.js/1/test.babel.js | 10 -- test/fixtures/babel.js/2/.babelrc | 3 - test/fixtures/babel.js/2/package.json | 6 - test/fixtures/babel.js/2/test.babel.js | 10 -- test/fixtures/babel.js/3/package.json | 5 - test/fixtures/babel.js/3/test.babel.js | 10 -- test/fixtures/buble.js/0/package.json | 5 - test/fixtures/buble.js/0/test.buble.js | 10 -- test/fixtures/cirru/0/package.json | 6 - test/fixtures/cirru/0/test.cirru | 6 - test/fixtures/cjsx/0/package.json | 5 - test/fixtures/cjsx/0/test.cjsx | 15 --- test/fixtures/co/0/package.json | 5 - test/fixtures/co/0/test.co | 9 -- test/fixtures/coffee.md/1/package.json | 5 - test/fixtures/coffee.md/1/test.coffee.md | 10 -- test/fixtures/coffee.md/2/package.json | 5 - test/fixtures/coffee.md/2/test.coffee.md | 10 -- test/fixtures/coffee.md/3/package.json | 5 - test/fixtures/coffee.md/3/test.coffee.md | 10 -- test/fixtures/coffee/1/package.json | 5 - test/fixtures/coffee/1/test.coffee | 6 - test/fixtures/coffee/2/package.json | 5 - test/fixtures/coffee/2/test.coffee | 6 - test/fixtures/coffee/3/package.json | 5 - test/fixtures/coffee/3/test.coffee | 6 - test/fixtures/csv/0/package.json | 5 - test/fixtures/csv/0/test.csv | 2 - test/fixtures/eg/0/package.json | 5 - test/fixtures/eg/0/test.eg | 9 -- test/fixtures/iced.md/0/package.json | 5 - test/fixtures/iced.md/0/test.iced.md | 9 -- test/fixtures/iced/0/package.json | 5 - test/fixtures/iced/0/test.iced | 6 - test/fixtures/iced/1/package.json | 5 - test/fixtures/iced/1/test.iced | 6 - test/fixtures/ini/0/package.json | 5 - test/fixtures/ini/0/test.ini | 4 - test/fixtures/json5/1/package.json | 5 - test/fixtures/json5/1/test.json5 | 10 -- test/fixtures/jsx/1/.babelrc | 3 - test/fixtures/jsx/1/package.json | 7 -- test/fixtures/jsx/1/test.jsx | 17 --- test/fixtures/jsx/2/.babelrc | 3 - test/fixtures/jsx/2/package.json | 7 -- test/fixtures/jsx/2/test.jsx | 17 --- test/fixtures/jsx/3/package.json | 5 - test/fixtures/jsx/3/test.jsx | 17 --- test/fixtures/jsx/4/package.json | 5 - test/fixtures/jsx/4/test.jsx | 17 --- test/fixtures/litcoffee/1/package.json | 5 - test/fixtures/litcoffee/1/test.litcoffee | 8 -- test/fixtures/litcoffee/2/package.json | 5 - test/fixtures/litcoffee/2/test.litcoffee | 8 -- test/fixtures/litcoffee/3/package.json | 5 - test/fixtures/litcoffee/3/test.litcoffee | 8 -- test/fixtures/liticed/0/package.json | 5 - test/fixtures/liticed/0/test.liticed | 8 -- test/fixtures/ls/0/package.json | 5 - test/fixtures/ls/0/test.ls | 6 - test/fixtures/ls/1/package.json | 5 - test/fixtures/ls/1/test.ls | 6 - test/fixtures/ts/1/package.json | 3 +- test/fixtures/ts/1/test.ts | 8 +- test/fixtures/ts/{5 => 2}/.babelrc | 0 test/fixtures/ts/{5 => 2}/component.ts | 0 test/fixtures/ts/2/package.json | 7 +- test/fixtures/ts/2/test.ts | 20 +--- test/fixtures/ts/2/tsconfig.json | 11 -- test/fixtures/ts/3/package.json | 3 +- test/fixtures/ts/3/test.ts | 24 ++-- test/fixtures/ts/3/tsconfig.json | 11 -- test/fixtures/ts/{7 => 4}/.swcrc | 0 test/fixtures/ts/4/package.json | 3 +- test/fixtures/ts/4/test.ts | 14 +-- test/fixtures/ts/4/tsconfig.json | 11 -- test/fixtures/ts/5/package.json | 9 -- test/fixtures/ts/5/test.ts | 5 - test/fixtures/ts/6/package.json | 6 - test/fixtures/ts/6/test.ts | 13 -- test/fixtures/ts/7/package.json | 6 - test/fixtures/ts/7/test.ts | 15 --- test/fixtures/tsx/1/package.json | 3 +- test/fixtures/tsx/{3 => 2}/.babelrc | 0 test/fixtures/tsx/2/data.tsx | 19 +++ test/fixtures/tsx/2/package.json | 6 +- test/fixtures/tsx/2/test.tsx | 6 +- test/fixtures/tsx/2/tsconfig.json | 12 -- test/fixtures/tsx/3/data.tsx | 28 ++--- test/fixtures/tsx/3/package.json | 7 +- test/fixtures/tsx/3/test.tsx | 21 +--- test/fixtures/tsx/{5 => 4}/.swcrc | 0 test/fixtures/tsx/4/data.tsx | 13 -- test/fixtures/tsx/4/package.json | 4 +- test/fixtures/tsx/4/test.tsx | 23 ++-- test/fixtures/tsx/5/package.json | 6 - test/fixtures/tsx/5/test.tsx | 18 --- test/fixtures/wisp/0/package.json | 5 - test/fixtures/wisp/0/test.wisp | 1 - test/fixtures/xml/0/package.json | 5 - test/fixtures/xml/0/test.xml | 5 - test/fixtures/yaml/0/package.json | 2 +- test/fixtures/yml/0/package.json | 2 +- test/index.js | 41 +------ 109 files changed, 147 insertions(+), 982 deletions(-) delete mode 100644 test/fixtures/babel.js/1/.babelrc delete mode 100644 test/fixtures/babel.js/1/package.json delete mode 100644 test/fixtures/babel.js/1/test.babel.js delete mode 100644 test/fixtures/babel.js/2/.babelrc delete mode 100644 test/fixtures/babel.js/2/package.json delete mode 100644 test/fixtures/babel.js/2/test.babel.js delete mode 100644 test/fixtures/babel.js/3/package.json delete mode 100644 test/fixtures/babel.js/3/test.babel.js delete mode 100644 test/fixtures/buble.js/0/package.json delete mode 100644 test/fixtures/buble.js/0/test.buble.js delete mode 100644 test/fixtures/cirru/0/package.json delete mode 100644 test/fixtures/cirru/0/test.cirru delete mode 100644 test/fixtures/cjsx/0/package.json delete mode 100644 test/fixtures/cjsx/0/test.cjsx delete mode 100644 test/fixtures/co/0/package.json delete mode 100644 test/fixtures/co/0/test.co delete mode 100644 test/fixtures/coffee.md/1/package.json delete mode 100644 test/fixtures/coffee.md/1/test.coffee.md delete mode 100644 test/fixtures/coffee.md/2/package.json delete mode 100644 test/fixtures/coffee.md/2/test.coffee.md delete mode 100644 test/fixtures/coffee.md/3/package.json delete mode 100644 test/fixtures/coffee.md/3/test.coffee.md delete mode 100644 test/fixtures/coffee/1/package.json delete mode 100644 test/fixtures/coffee/1/test.coffee delete mode 100644 test/fixtures/coffee/2/package.json delete mode 100644 test/fixtures/coffee/2/test.coffee delete mode 100644 test/fixtures/coffee/3/package.json delete mode 100644 test/fixtures/coffee/3/test.coffee delete mode 100644 test/fixtures/csv/0/package.json delete mode 100644 test/fixtures/csv/0/test.csv delete mode 100644 test/fixtures/eg/0/package.json delete mode 100644 test/fixtures/eg/0/test.eg delete mode 100644 test/fixtures/iced.md/0/package.json delete mode 100644 test/fixtures/iced.md/0/test.iced.md delete mode 100644 test/fixtures/iced/0/package.json delete mode 100644 test/fixtures/iced/0/test.iced delete mode 100644 test/fixtures/iced/1/package.json delete mode 100644 test/fixtures/iced/1/test.iced delete mode 100644 test/fixtures/ini/0/package.json delete mode 100644 test/fixtures/ini/0/test.ini delete mode 100644 test/fixtures/json5/1/package.json delete mode 100644 test/fixtures/json5/1/test.json5 delete mode 100644 test/fixtures/jsx/1/.babelrc delete mode 100644 test/fixtures/jsx/1/package.json delete mode 100644 test/fixtures/jsx/1/test.jsx delete mode 100644 test/fixtures/jsx/2/.babelrc delete mode 100644 test/fixtures/jsx/2/package.json delete mode 100644 test/fixtures/jsx/2/test.jsx delete mode 100644 test/fixtures/jsx/3/package.json delete mode 100644 test/fixtures/jsx/3/test.jsx delete mode 100644 test/fixtures/jsx/4/package.json delete mode 100644 test/fixtures/jsx/4/test.jsx delete mode 100644 test/fixtures/litcoffee/1/package.json delete mode 100644 test/fixtures/litcoffee/1/test.litcoffee delete mode 100644 test/fixtures/litcoffee/2/package.json delete mode 100644 test/fixtures/litcoffee/2/test.litcoffee delete mode 100644 test/fixtures/litcoffee/3/package.json delete mode 100644 test/fixtures/litcoffee/3/test.litcoffee delete mode 100644 test/fixtures/liticed/0/package.json delete mode 100644 test/fixtures/liticed/0/test.liticed delete mode 100644 test/fixtures/ls/0/package.json delete mode 100644 test/fixtures/ls/0/test.ls delete mode 100644 test/fixtures/ls/1/package.json delete mode 100644 test/fixtures/ls/1/test.ls rename test/fixtures/ts/{5 => 2}/.babelrc (100%) rename test/fixtures/ts/{5 => 2}/component.ts (100%) delete mode 100644 test/fixtures/ts/2/tsconfig.json delete mode 100644 test/fixtures/ts/3/tsconfig.json rename test/fixtures/ts/{7 => 4}/.swcrc (100%) delete mode 100644 test/fixtures/ts/4/tsconfig.json delete mode 100644 test/fixtures/ts/5/package.json delete mode 100644 test/fixtures/ts/5/test.ts delete mode 100644 test/fixtures/ts/6/package.json delete mode 100644 test/fixtures/ts/6/test.ts delete mode 100644 test/fixtures/ts/7/package.json delete mode 100644 test/fixtures/ts/7/test.ts rename test/fixtures/tsx/{3 => 2}/.babelrc (100%) create mode 100644 test/fixtures/tsx/2/data.tsx delete mode 100644 test/fixtures/tsx/2/tsconfig.json rename test/fixtures/tsx/{5 => 4}/.swcrc (100%) delete mode 100644 test/fixtures/tsx/4/data.tsx delete mode 100644 test/fixtures/tsx/5/package.json delete mode 100644 test/fixtures/tsx/5/test.tsx delete mode 100644 test/fixtures/wisp/0/package.json delete mode 100644 test/fixtures/wisp/0/test.wisp delete mode 100644 test/fixtures/xml/0/package.json delete mode 100644 test/fixtures/xml/0/test.xml diff --git a/README.md b/README.md index f56410c..dee4bec 100644 --- a/README.md +++ b/README.md @@ -26,45 +26,16 @@ Map file types to modules which provide a [require.extensions] loader. ```js { - '.babel.js': [ - { - module: '@babel/register', - register: function(hook) { - hook({ - extensions: '.js', - rootMode: 'upward-optional', - ignore: [ignoreNonBabelAndNodeModules], - }); - }, - }, - { - module: 'babel-register', - register: function(hook) { - hook({ - extensions: '.js', - ignore: ignoreNonBabelAndNodeModules, - }); - }, - }, - { - module: 'babel-core/register', - register: function(hook) { - hook({ - extensions: '.js', - ignore: ignoreNonBabelAndNodeModules, - }); - }, - }, - { - module: 'babel/register', - register: function(hook) { - hook({ - extensions: '.js', - ignore: ignoreNonBabelAndNodeModules, - }); - }, + '.babel.js': { + module: '@babel/register', + register: function(hook) { + hook({ + extensions: '.js', + rootMode: 'upward-optional', + ignore: [ignoreNonBabelAndNodeModules], + }); }, - ], + }, '.babel.ts': [ { module: '@babel/register', @@ -77,14 +48,8 @@ Map file types to modules which provide a [require.extensions] loader. }, }, ], - '.buble.js': 'buble/register', - '.cirru': 'cirru-script/lib/register', - '.cjsx': 'node-cjsx/register', - '.co': 'coco', - '.coffee': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], - '.coffee.md': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], - '.csv': 'require-csv', - '.eg': 'earlgrey/register', + '.coffee': 'coffeescript/register', + '.coffee.md': 'coffeescript/register', '.esm.js': { module: 'esm', register: function(hook) { @@ -94,60 +59,20 @@ Map file types to modules which provide a [require.extensions] loader. require.extensions['.js'] = esmLoader('module')._extensions['.js']; }, }, - '.iced': ['iced-coffee-script/register', 'iced-coffee-script'], - '.iced.md': 'iced-coffee-script/register', - '.ini': 'require-ini', '.js': null, '.json': null, - '.json5': ['json5/lib/register', 'json5/lib/require'], - '.jsx': [ - { - module: '@babel/register', - register: function(hook) { - hook({ - extensions: '.jsx', - rootMode: 'upward-optional', - ignore: [ignoreNonBabelAndNodeModules], - }); - }, - }, - { - module: 'babel-register', - register: function(hook) { - hook({ - extensions: '.jsx', - ignore: ignoreNonBabelAndNodeModules, - }); - }, - }, - { - module: 'babel-core/register', - register: function(hook) { - hook({ - extensions: '.jsx', - ignore: ignoreNonBabelAndNodeModules, - }); - }, - }, - { - module: 'babel/register', - register: function(hook) { - hook({ - extensions: '.jsx', - ignore: ignoreNonBabelAndNodeModules, - }); - }, - }, - { - module: 'node-jsx', - register: function(hook) { - hook.install({ extension: '.jsx', harmony: true }); - }, + '.json5': 'json5/lib/register', + '.jsx': { + module: '@babel/register', + register: function(hook) { + hook({ + extensions: '.jsx', + rootMode: 'upward-optional', + ignore: [ignoreNonBabelAndNodeModules], + }); }, - ], - '.litcoffee': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], - '.liticed': 'iced-coffee-script/register', - '.ls': ['livescript', 'LiveScript'], + }, + '.litcoffee': 'coffeescript/register', '.mjs': '/absolute/path/to/interpret/mjs-stub.js', '.node': null, '.toml': { @@ -158,9 +83,6 @@ Map file types to modules which provide a [require.extensions] loader. }, '.ts': [ 'ts-node/register', - 'typescript-node/register', - 'typescript-register', - 'typescript-require', 'sucrase/register/ts', { module: '@babel/register', @@ -175,7 +97,6 @@ Map file types to modules which provide a [require.extensions] loader. ], '.tsx': [ 'ts-node/register', - 'typescript-node/register', 'sucrase/register', { module: '@babel/register', @@ -188,10 +109,8 @@ Map file types to modules which provide a [require.extensions] loader. }, }, ], - '.wisp': 'wisp/engine/node', - '.xml': 'require-xml', - '.yaml': 'require-yaml', - '.yml': 'require-yaml', + '.yaml': 'yaml-hook/register', + '.yml': 'yaml-hook/register', } ``` diff --git a/index.js b/index.js index c003144..1cabc4a 100644 --- a/index.js +++ b/index.js @@ -14,56 +14,22 @@ var endsInEsbuildTsx = /\.esbuild\.tsx$/; var mjsStub = path.join(__dirname, 'mjs-stub'); -function ignoreNonBabelAndNodeModules(file) { - return !endsInBabelJs.test(file) && - path.relative(process.cwd(), file).split(path.sep).indexOf('node_modules') >= 0; -} - // Not part of the above check because it seems broken function isNodeModules(file) { return path.relative(process.cwd(), file).split(path.sep).indexOf('node_modules') >= 0; } var extensions = { - '.babel.js': [ - { - module: '@babel/register', - register: function(hook) { - hook({ - extensions: '.js', - rootMode: 'upward-optional', - overrides: [{ only: [endsInBabelJs] }], - }); - }, - }, - { - module: 'babel-register', - register: function(hook) { - hook({ - extensions: '.js', - ignore: ignoreNonBabelAndNodeModules, - }); - }, - }, - { - module: 'babel-core/register', - register: function(hook) { - hook({ - extensions: '.js', - ignore: ignoreNonBabelAndNodeModules, - }); - }, - }, - { - module: 'babel/register', - register: function(hook) { - hook({ - extensions: '.js', - ignore: ignoreNonBabelAndNodeModules, - }); - }, + '.babel.js': { + module: '@babel/register', + register: function(hook) { + hook({ + extensions: '.js', + rootMode: 'upward-optional', + overrides: [{ only: [endsInBabelJs] }], + }); }, - ], + }, '.babel.jsx': { module: '@babel/register', register: function(hook) { @@ -96,14 +62,8 @@ var extensions = { }); }, }, - '.buble.js': 'buble/register', - '.cirru': 'cirru-script/lib/register', - '.cjsx': 'node-cjsx/register', - '.co': 'coco', - '.coffee': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], - '.coffee.md': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], - '.csv': 'require-csv', - '.eg': 'earlgrey/register', + '.coffee': 'coffeescript/register', + '.coffee.md': 'coffeescript/register', '.esbuild.js': { module: 'esbuild-register/dist/node', register: function(mod) { @@ -161,60 +121,20 @@ var extensions = { require.extensions['.js'] = esmLoader('module')._extensions['.js']; }, }, - '.iced': ['iced-coffee-script/register', 'iced-coffee-script'], - '.iced.md': 'iced-coffee-script/register', - '.ini': 'require-ini', '.js': null, '.json': null, - '.json5': ['json5/lib/register', 'json5/lib/require'], - '.jsx': [ - { - module: '@babel/register', - register: function(hook) { - hook({ - extensions: '.jsx', - rootMode: 'upward-optional', - overrides: [{ only: [endsInJsx] }], - }); - }, - }, - { - module: 'babel-register', - register: function(hook) { - hook({ - extensions: '.jsx', - ignore: ignoreNonBabelAndNodeModules, - }); - }, - }, - { - module: 'babel-core/register', - register: function(hook) { - hook({ - extensions: '.jsx', - ignore: ignoreNonBabelAndNodeModules, - }); - }, - }, - { - module: 'babel/register', - register: function(hook) { - hook({ - extensions: '.jsx', - ignore: ignoreNonBabelAndNodeModules, - }); - }, - }, - { - module: 'node-jsx', - register: function(hook) { - hook.install({ extension: '.jsx', harmony: true }); - }, + '.json5': 'json5/lib/register', + '.jsx': { + module: '@babel/register', + register: function(hook) { + hook({ + extensions: '.jsx', + rootMode: 'upward-optional', + overrides: [{ only: [endsInJsx] }], + }); }, - ], - '.litcoffee': ['coffeescript/register', 'coffee-script/register', 'coffeescript', 'coffee-script'], - '.liticed': 'iced-coffee-script/register', - '.ls': ['livescript', 'LiveScript'], + }, + '.litcoffee': 'coffeescript/register', '.mjs': mjsStub, '.node': null, '.toml': { @@ -225,9 +145,6 @@ var extensions = { }, '.ts': [ 'ts-node/register', - 'typescript-node/register', - 'typescript-register', - 'typescript-require', 'sucrase/register/ts', { module: '@babel/register', @@ -264,7 +181,6 @@ var extensions = { ], '.tsx': [ 'ts-node/register', - 'typescript-node/register', 'sucrase/register', { module: '@babel/register', @@ -299,10 +215,8 @@ var extensions = { }, }, ], - '.wisp': 'wisp/engine/node', - '.xml': 'require-xml', - '.yaml': 'require-yaml', - '.yml': 'require-yaml', + '.yaml': 'yaml-hook/register', + '.yml': 'yaml-hook/register', }; var jsVariantExtensions = [ @@ -315,24 +229,14 @@ var jsVariantExtensions = [ '.esbuild.jsx', '.esbuild.ts', '.esbuild.tsx', - '.buble.js', - '.cirru', - '.cjsx', - '.co', '.coffee', '.coffee.md', - '.eg', '.esm.js', - '.iced', - '.iced.md', '.jsx', '.litcoffee', - '.liticed', - '.ls', '.mjs', '.ts', '.tsx', - '.wisp', ]; module.exports = { diff --git a/package.json b/package.json index cc05601..12a5387 100644 --- a/package.json +++ b/package.json @@ -39,35 +39,20 @@ "trash-cli": "^3.0.0" }, "keywords": [ - "cirru-script", - "cjsx", - "co", - "coco", "coffee", - "coffee-script", "coffee.md", "coffeescript", - "csv", - "earlgrey", "es", "es6", - "iced", - "iced.md", - "iced-coffee-script", - "ini", "js", "json", "json5", "jsx", "react", "litcoffee", - "liticed", - "ls", - "livescript", "toml", "ts", "typescript", - "wisp", "xml", "yaml", "yml" diff --git a/test/fixtures/babel.js/1/.babelrc b/test/fixtures/babel.js/1/.babelrc deleted file mode 100644 index c13c5f6..0000000 --- a/test/fixtures/babel.js/1/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["es2015"] -} diff --git a/test/fixtures/babel.js/1/package.json b/test/fixtures/babel.js/1/package.json deleted file mode 100644 index c35f68d..0000000 --- a/test/fixtures/babel.js/1/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "babel-preset-es2015": "^6.24.1", - "babel-register": "^6.26.0" - } -} diff --git a/test/fixtures/babel.js/1/test.babel.js b/test/fixtures/babel.js/1/test.babel.js deleted file mode 100644 index e929c98..0000000 --- a/test/fixtures/babel.js/1/test.babel.js +++ /dev/null @@ -1,10 +0,0 @@ -// Test ES6 arrow functions -var fn = () => { - var trueKey = true; - var falseKey = false; - var subKey = { subProp: 1 }; - // Test harmony object short notation - return { data: { trueKey, falseKey, subKey}}; -}; - -module.exports = fn(); diff --git a/test/fixtures/babel.js/2/.babelrc b/test/fixtures/babel.js/2/.babelrc deleted file mode 100644 index c13c5f6..0000000 --- a/test/fixtures/babel.js/2/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["es2015"] -} diff --git a/test/fixtures/babel.js/2/package.json b/test/fixtures/babel.js/2/package.json deleted file mode 100644 index c920682..0000000 --- a/test/fixtures/babel.js/2/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "babel-core": "^6.26.3", - "babel-preset-es2015": "^6.24.1" - } -} diff --git a/test/fixtures/babel.js/2/test.babel.js b/test/fixtures/babel.js/2/test.babel.js deleted file mode 100644 index e929c98..0000000 --- a/test/fixtures/babel.js/2/test.babel.js +++ /dev/null @@ -1,10 +0,0 @@ -// Test ES6 arrow functions -var fn = () => { - var trueKey = true; - var falseKey = false; - var subKey = { subProp: 1 }; - // Test harmony object short notation - return { data: { trueKey, falseKey, subKey}}; -}; - -module.exports = fn(); diff --git a/test/fixtures/babel.js/3/package.json b/test/fixtures/babel.js/3/package.json deleted file mode 100644 index c5afc56..0000000 --- a/test/fixtures/babel.js/3/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "babel": "^5.8.38" - } -} diff --git a/test/fixtures/babel.js/3/test.babel.js b/test/fixtures/babel.js/3/test.babel.js deleted file mode 100644 index e929c98..0000000 --- a/test/fixtures/babel.js/3/test.babel.js +++ /dev/null @@ -1,10 +0,0 @@ -// Test ES6 arrow functions -var fn = () => { - var trueKey = true; - var falseKey = false; - var subKey = { subProp: 1 }; - // Test harmony object short notation - return { data: { trueKey, falseKey, subKey}}; -}; - -module.exports = fn(); diff --git a/test/fixtures/buble.js/0/package.json b/test/fixtures/buble.js/0/package.json deleted file mode 100644 index f51ab68..0000000 --- a/test/fixtures/buble.js/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "buble": "^0.19.6" - } -} diff --git a/test/fixtures/buble.js/0/test.buble.js b/test/fixtures/buble.js/0/test.buble.js deleted file mode 100644 index e929c98..0000000 --- a/test/fixtures/buble.js/0/test.buble.js +++ /dev/null @@ -1,10 +0,0 @@ -// Test ES6 arrow functions -var fn = () => { - var trueKey = true; - var falseKey = false; - var subKey = { subProp: 1 }; - // Test harmony object short notation - return { data: { trueKey, falseKey, subKey}}; -}; - -module.exports = fn(); diff --git a/test/fixtures/cirru/0/package.json b/test/fixtures/cirru/0/package.json deleted file mode 100644 index d417462..0000000 --- a/test/fixtures/cirru/0/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "babel-preset-es2015": "^6.24.1", - "cirru-script": "^0.5.5" - } -} diff --git a/test/fixtures/cirru/0/test.cirru b/test/fixtures/cirru/0/test.cirru deleted file mode 100644 index 7b18209..0000000 --- a/test/fixtures/cirru/0/test.cirru +++ /dev/null @@ -1,6 +0,0 @@ -= module.exports $ object - :data $ object - :falseKey false - :subKey $ object - :subProp 1 - :trueKey true diff --git a/test/fixtures/cjsx/0/package.json b/test/fixtures/cjsx/0/package.json deleted file mode 100644 index e78a54f..0000000 --- a/test/fixtures/cjsx/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "node-cjsx": "^2.0.0" - } -} diff --git a/test/fixtures/cjsx/0/test.cjsx b/test/fixtures/cjsx/0/test.cjsx deleted file mode 100644 index 2713542..0000000 --- a/test/fixtures/cjsx/0/test.cjsx +++ /dev/null @@ -1,15 +0,0 @@ -React = createElement: (Component) -> - Component() -# Test harmony arrow functions - -Component = -> - trueKey = true - falseKey = false - subKey = subProp: 1 - # Test harmony object short notation - { data: - trueKey: trueKey - falseKey: falseKey - subKey: subKey } - -module.exports = diff --git a/test/fixtures/co/0/package.json b/test/fixtures/co/0/package.json deleted file mode 100644 index 2680465..0000000 --- a/test/fixtures/co/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "coco": "^0.9.1" - } -} diff --git a/test/fixtures/co/0/test.co b/test/fixtures/co/0/test.co deleted file mode 100644 index 12f6fcd..0000000 --- a/test/fixtures/co/0/test.co +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - data: { - trueKey: true - falseKey: false - subKey: { - subProp: 1 - } - } -} diff --git a/test/fixtures/coffee.md/1/package.json b/test/fixtures/coffee.md/1/package.json deleted file mode 100644 index 538ad86..0000000 --- a/test/fixtures/coffee.md/1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "coffee-script": "^1.12.7" - } -} diff --git a/test/fixtures/coffee.md/1/test.coffee.md b/test/fixtures/coffee.md/1/test.coffee.md deleted file mode 100644 index 42ada56..0000000 --- a/test/fixtures/coffee.md/1/test.coffee.md +++ /dev/null @@ -1,10 +0,0 @@ -Test Fixture -============ - - module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 - diff --git a/test/fixtures/coffee.md/2/package.json b/test/fixtures/coffee.md/2/package.json deleted file mode 100644 index 1a44d02..0000000 --- a/test/fixtures/coffee.md/2/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "coffeescript": "^2.3.2" - } -} diff --git a/test/fixtures/coffee.md/2/test.coffee.md b/test/fixtures/coffee.md/2/test.coffee.md deleted file mode 100644 index 42ada56..0000000 --- a/test/fixtures/coffee.md/2/test.coffee.md +++ /dev/null @@ -1,10 +0,0 @@ -Test Fixture -============ - - module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 - diff --git a/test/fixtures/coffee.md/3/package.json b/test/fixtures/coffee.md/3/package.json deleted file mode 100644 index 538ad86..0000000 --- a/test/fixtures/coffee.md/3/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "coffee-script": "^1.12.7" - } -} diff --git a/test/fixtures/coffee.md/3/test.coffee.md b/test/fixtures/coffee.md/3/test.coffee.md deleted file mode 100644 index 42ada56..0000000 --- a/test/fixtures/coffee.md/3/test.coffee.md +++ /dev/null @@ -1,10 +0,0 @@ -Test Fixture -============ - - module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 - diff --git a/test/fixtures/coffee/1/package.json b/test/fixtures/coffee/1/package.json deleted file mode 100644 index 538ad86..0000000 --- a/test/fixtures/coffee/1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "coffee-script": "^1.12.7" - } -} diff --git a/test/fixtures/coffee/1/test.coffee b/test/fixtures/coffee/1/test.coffee deleted file mode 100644 index 61d3b46..0000000 --- a/test/fixtures/coffee/1/test.coffee +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/coffee/2/package.json b/test/fixtures/coffee/2/package.json deleted file mode 100644 index 1a44d02..0000000 --- a/test/fixtures/coffee/2/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "coffeescript": "^2.3.2" - } -} diff --git a/test/fixtures/coffee/2/test.coffee b/test/fixtures/coffee/2/test.coffee deleted file mode 100644 index 61d3b46..0000000 --- a/test/fixtures/coffee/2/test.coffee +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/coffee/3/package.json b/test/fixtures/coffee/3/package.json deleted file mode 100644 index 538ad86..0000000 --- a/test/fixtures/coffee/3/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "coffee-script": "^1.12.7" - } -} diff --git a/test/fixtures/coffee/3/test.coffee b/test/fixtures/coffee/3/test.coffee deleted file mode 100644 index 61d3b46..0000000 --- a/test/fixtures/coffee/3/test.coffee +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/csv/0/package.json b/test/fixtures/csv/0/package.json deleted file mode 100644 index dc76fcc..0000000 --- a/test/fixtures/csv/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "require-csv": "0.0.1" - } -} diff --git a/test/fixtures/csv/0/test.csv b/test/fixtures/csv/0/test.csv deleted file mode 100644 index d831a3d..0000000 --- a/test/fixtures/csv/0/test.csv +++ /dev/null @@ -1,2 +0,0 @@ -"r1c1","r1c2" -"r2c1","r2c2" diff --git a/test/fixtures/eg/0/package.json b/test/fixtures/eg/0/package.json deleted file mode 100644 index 9ad12c9..0000000 --- a/test/fixtures/eg/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "earlgrey": "^0.1.2" - } -} diff --git a/test/fixtures/eg/0/test.eg b/test/fixtures/eg/0/test.eg deleted file mode 100644 index 7ee06f1..0000000 --- a/test/fixtures/eg/0/test.eg +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - data = { - trueKey = true - falseKey = false - subKey = { - subProp = 1 - } - } -} diff --git a/test/fixtures/iced.md/0/package.json b/test/fixtures/iced.md/0/package.json deleted file mode 100644 index 9980657..0000000 --- a/test/fixtures/iced.md/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "iced-coffee-script": "^108.0.11" - } -} diff --git a/test/fixtures/iced.md/0/test.iced.md b/test/fixtures/iced.md/0/test.iced.md deleted file mode 100644 index 55dc760..0000000 --- a/test/fixtures/iced.md/0/test.iced.md +++ /dev/null @@ -1,9 +0,0 @@ -Test Fixture -============ - - module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/iced/0/package.json b/test/fixtures/iced/0/package.json deleted file mode 100644 index 9980657..0000000 --- a/test/fixtures/iced/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "iced-coffee-script": "^108.0.11" - } -} diff --git a/test/fixtures/iced/0/test.iced b/test/fixtures/iced/0/test.iced deleted file mode 100644 index 61d3b46..0000000 --- a/test/fixtures/iced/0/test.iced +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/iced/1/package.json b/test/fixtures/iced/1/package.json deleted file mode 100644 index 9980657..0000000 --- a/test/fixtures/iced/1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "iced-coffee-script": "^108.0.11" - } -} diff --git a/test/fixtures/iced/1/test.iced b/test/fixtures/iced/1/test.iced deleted file mode 100644 index 61d3b46..0000000 --- a/test/fixtures/iced/1/test.iced +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/ini/0/package.json b/test/fixtures/ini/0/package.json deleted file mode 100644 index 08f0b7d..0000000 --- a/test/fixtures/ini/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "require-ini": "0.0.1" - } -} diff --git a/test/fixtures/ini/0/test.ini b/test/fixtures/ini/0/test.ini deleted file mode 100644 index d52fa6a..0000000 --- a/test/fixtures/ini/0/test.ini +++ /dev/null @@ -1,4 +0,0 @@ -[data] - falseKey = false - subKey[subProp] = 1 - trueKey = true diff --git a/test/fixtures/json5/1/package.json b/test/fixtures/json5/1/package.json deleted file mode 100644 index 620e3d5..0000000 --- a/test/fixtures/json5/1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "json5": "^0.5.0" - } -} diff --git a/test/fixtures/json5/1/test.json5 b/test/fixtures/json5/1/test.json5 deleted file mode 100644 index 3b39a49..0000000 --- a/test/fixtures/json5/1/test.json5 +++ /dev/null @@ -1,10 +0,0 @@ -{ - "data": { - "trueKey": true, - "falseKey": false, - "subKey": { - "subProp": 1 - } - } - /* omg, a comment in json?? */ -} diff --git a/test/fixtures/jsx/1/.babelrc b/test/fixtures/jsx/1/.babelrc deleted file mode 100644 index 86c445f..0000000 --- a/test/fixtures/jsx/1/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["es2015", "react"] -} diff --git a/test/fixtures/jsx/1/package.json b/test/fixtures/jsx/1/package.json deleted file mode 100644 index 5c1212f..0000000 --- a/test/fixtures/jsx/1/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "dependencies": { - "babel-preset-es2015": "^6.24.1", - "babel-preset-react": "^6.24.1", - "babel-register": "^6.26.0" - } -} diff --git a/test/fixtures/jsx/1/test.jsx b/test/fixtures/jsx/1/test.jsx deleted file mode 100644 index acfb81c..0000000 --- a/test/fixtures/jsx/1/test.jsx +++ /dev/null @@ -1,17 +0,0 @@ -const React = { - createElement: function(Component){ - return Component(); - } -}; - -// Test harmony arrow functions -const Component = () => { - var trueKey = true; - var falseKey = false; - var subKey = { subProp: 1 }; - // Test harmony object short notation - return { data: { trueKey, falseKey, subKey}}; -}; - -// Test JSX syntax -module.exports = ; diff --git a/test/fixtures/jsx/2/.babelrc b/test/fixtures/jsx/2/.babelrc deleted file mode 100644 index 86c445f..0000000 --- a/test/fixtures/jsx/2/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["es2015", "react"] -} diff --git a/test/fixtures/jsx/2/package.json b/test/fixtures/jsx/2/package.json deleted file mode 100644 index 11c4070..0000000 --- a/test/fixtures/jsx/2/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "dependencies": { - "babel-core": "^6.26.3", - "babel-preset-es2015": "^6.24.1", - "babel-preset-react": "^6.24.1" - } -} diff --git a/test/fixtures/jsx/2/test.jsx b/test/fixtures/jsx/2/test.jsx deleted file mode 100644 index acfb81c..0000000 --- a/test/fixtures/jsx/2/test.jsx +++ /dev/null @@ -1,17 +0,0 @@ -const React = { - createElement: function(Component){ - return Component(); - } -}; - -// Test harmony arrow functions -const Component = () => { - var trueKey = true; - var falseKey = false; - var subKey = { subProp: 1 }; - // Test harmony object short notation - return { data: { trueKey, falseKey, subKey}}; -}; - -// Test JSX syntax -module.exports = ; diff --git a/test/fixtures/jsx/3/package.json b/test/fixtures/jsx/3/package.json deleted file mode 100644 index c5afc56..0000000 --- a/test/fixtures/jsx/3/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "babel": "^5.8.38" - } -} diff --git a/test/fixtures/jsx/3/test.jsx b/test/fixtures/jsx/3/test.jsx deleted file mode 100644 index acfb81c..0000000 --- a/test/fixtures/jsx/3/test.jsx +++ /dev/null @@ -1,17 +0,0 @@ -const React = { - createElement: function(Component){ - return Component(); - } -}; - -// Test harmony arrow functions -const Component = () => { - var trueKey = true; - var falseKey = false; - var subKey = { subProp: 1 }; - // Test harmony object short notation - return { data: { trueKey, falseKey, subKey}}; -}; - -// Test JSX syntax -module.exports = ; diff --git a/test/fixtures/jsx/4/package.json b/test/fixtures/jsx/4/package.json deleted file mode 100644 index c475a7d..0000000 --- a/test/fixtures/jsx/4/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "node-jsx": "^0.13.3" - } -} diff --git a/test/fixtures/jsx/4/test.jsx b/test/fixtures/jsx/4/test.jsx deleted file mode 100644 index acfb81c..0000000 --- a/test/fixtures/jsx/4/test.jsx +++ /dev/null @@ -1,17 +0,0 @@ -const React = { - createElement: function(Component){ - return Component(); - } -}; - -// Test harmony arrow functions -const Component = () => { - var trueKey = true; - var falseKey = false; - var subKey = { subProp: 1 }; - // Test harmony object short notation - return { data: { trueKey, falseKey, subKey}}; -}; - -// Test JSX syntax -module.exports = ; diff --git a/test/fixtures/litcoffee/1/package.json b/test/fixtures/litcoffee/1/package.json deleted file mode 100644 index 538ad86..0000000 --- a/test/fixtures/litcoffee/1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "coffee-script": "^1.12.7" - } -} diff --git a/test/fixtures/litcoffee/1/test.litcoffee b/test/fixtures/litcoffee/1/test.litcoffee deleted file mode 100644 index 297d23f..0000000 --- a/test/fixtures/litcoffee/1/test.litcoffee +++ /dev/null @@ -1,8 +0,0 @@ -# comment - - module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/litcoffee/2/package.json b/test/fixtures/litcoffee/2/package.json deleted file mode 100644 index 1a44d02..0000000 --- a/test/fixtures/litcoffee/2/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "coffeescript": "^2.3.2" - } -} diff --git a/test/fixtures/litcoffee/2/test.litcoffee b/test/fixtures/litcoffee/2/test.litcoffee deleted file mode 100644 index 297d23f..0000000 --- a/test/fixtures/litcoffee/2/test.litcoffee +++ /dev/null @@ -1,8 +0,0 @@ -# comment - - module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/litcoffee/3/package.json b/test/fixtures/litcoffee/3/package.json deleted file mode 100644 index 538ad86..0000000 --- a/test/fixtures/litcoffee/3/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "coffee-script": "^1.12.7" - } -} diff --git a/test/fixtures/litcoffee/3/test.litcoffee b/test/fixtures/litcoffee/3/test.litcoffee deleted file mode 100644 index 297d23f..0000000 --- a/test/fixtures/litcoffee/3/test.litcoffee +++ /dev/null @@ -1,8 +0,0 @@ -# comment - - module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/liticed/0/package.json b/test/fixtures/liticed/0/package.json deleted file mode 100644 index 9980657..0000000 --- a/test/fixtures/liticed/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "iced-coffee-script": "^108.0.11" - } -} diff --git a/test/fixtures/liticed/0/test.liticed b/test/fixtures/liticed/0/test.liticed deleted file mode 100644 index 297d23f..0000000 --- a/test/fixtures/liticed/0/test.liticed +++ /dev/null @@ -1,8 +0,0 @@ -# comment - - module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/ls/0/package.json b/test/fixtures/ls/0/package.json deleted file mode 100644 index 3ecf027..0000000 --- a/test/fixtures/ls/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "livescript": "^1.6.0" - } -} diff --git a/test/fixtures/ls/0/test.ls b/test/fixtures/ls/0/test.ls deleted file mode 100644 index 61d3b46..0000000 --- a/test/fixtures/ls/0/test.ls +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/ls/1/package.json b/test/fixtures/ls/1/package.json deleted file mode 100644 index 5d2fab9..0000000 --- a/test/fixtures/ls/1/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "LiveScript": "^1.3.1" - } -} diff --git a/test/fixtures/ls/1/test.ls b/test/fixtures/ls/1/test.ls deleted file mode 100644 index 61d3b46..0000000 --- a/test/fixtures/ls/1/test.ls +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = - data: - trueKey: true - falseKey: false - subKey: - subProp: 1 diff --git a/test/fixtures/ts/1/package.json b/test/fixtures/ts/1/package.json index e0757af..dc0534c 100644 --- a/test/fixtures/ts/1/package.json +++ b/test/fixtures/ts/1/package.json @@ -1,6 +1,5 @@ { "dependencies": { - "typescript": "1.5.3", - "typescript-node": "^0.1.3" + "sucrase": "^3.12.1" } } diff --git a/test/fixtures/ts/1/test.ts b/test/fixtures/ts/1/test.ts index c4c77e6..46c3ac2 100644 --- a/test/fixtures/ts/1/test.ts +++ b/test/fixtures/ts/1/test.ts @@ -16,4 +16,10 @@ var test: { } }; -export default test; +var main: { + default: typeof test +} = { + default: test +}; + +export = main; diff --git a/test/fixtures/ts/5/.babelrc b/test/fixtures/ts/2/.babelrc similarity index 100% rename from test/fixtures/ts/5/.babelrc rename to test/fixtures/ts/2/.babelrc diff --git a/test/fixtures/ts/5/component.ts b/test/fixtures/ts/2/component.ts similarity index 100% rename from test/fixtures/ts/5/component.ts rename to test/fixtures/ts/2/component.ts diff --git a/test/fixtures/ts/2/package.json b/test/fixtures/ts/2/package.json index 4101654..5fa8c33 100644 --- a/test/fixtures/ts/2/package.json +++ b/test/fixtures/ts/2/package.json @@ -1,6 +1,9 @@ { "dependencies": { - "typescript": "1.4.1", - "typescript-register": "^1.1.0" + "@babel/core": "^7.2.2", + "@babel/preset-env": "^7.2.3", + "@babel/preset-react": "^7.0.0", + "@babel/preset-typescript": "^7.1.0", + "@babel/register": "^7.0.0" } } diff --git a/test/fixtures/ts/2/test.ts b/test/fixtures/ts/2/test.ts index be06f12..5c3065b 100644 --- a/test/fixtures/ts/2/test.ts +++ b/test/fixtures/ts/2/test.ts @@ -1,19 +1,5 @@ -var trueKey: boolean = true; -var falseKey: boolean = false; -var subProp: number = 1; +import Component from "./component" -var test = { - data: { - trueKey: trueKey, - falseKey: falseKey, - subKey: { - subProp: subProp - } - } -}; +var test: typeof Component = { ...Component } -var main = { - default: test -}; - -export = main; +export default test diff --git a/test/fixtures/ts/2/tsconfig.json b/test/fixtures/ts/2/tsconfig.json deleted file mode 100644 index ca687b6..0000000 --- a/test/fixtures/ts/2/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "declaration": false, - "noImplicitAny": false, - "removeComments": true, - "sourceMap": true, - "outDir": ".tmp" - } -} diff --git a/test/fixtures/ts/3/package.json b/test/fixtures/ts/3/package.json index 1d30471..b32c446 100644 --- a/test/fixtures/ts/3/package.json +++ b/test/fixtures/ts/3/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "typescript-require": "^0.2.10" + "esbuild": "^0.14.29", + "esbuild-register": "^3.3.2" } } diff --git a/test/fixtures/ts/3/test.ts b/test/fixtures/ts/3/test.ts index be06f12..5bd9e99 100644 --- a/test/fixtures/ts/3/test.ts +++ b/test/fixtures/ts/3/test.ts @@ -1,19 +1,13 @@ -var trueKey: boolean = true; -var falseKey: boolean = false; -var subProp: number = 1; +function add(x: number, y: number): number { + return x + y; +} -var test = { +export default { data: { - trueKey: trueKey, - falseKey: falseKey, + trueKey: true as boolean, + falseKey: false as boolean, subKey: { - subProp: subProp - } - } + subProp: add(0.5, 0.5), + }, + }, }; - -var main = { - default: test -}; - -export = main; diff --git a/test/fixtures/ts/3/tsconfig.json b/test/fixtures/ts/3/tsconfig.json deleted file mode 100644 index ca687b6..0000000 --- a/test/fixtures/ts/3/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "declaration": false, - "noImplicitAny": false, - "removeComments": true, - "sourceMap": true, - "outDir": ".tmp" - } -} diff --git a/test/fixtures/ts/7/.swcrc b/test/fixtures/ts/4/.swcrc similarity index 100% rename from test/fixtures/ts/7/.swcrc rename to test/fixtures/ts/4/.swcrc diff --git a/test/fixtures/ts/4/package.json b/test/fixtures/ts/4/package.json index dc0534c..e345156 100644 --- a/test/fixtures/ts/4/package.json +++ b/test/fixtures/ts/4/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "sucrase": "^3.12.1" + "@swc/core": "^1.2.110", + "@swc/register": "^0.1.7" } } diff --git a/test/fixtures/ts/4/test.ts b/test/fixtures/ts/4/test.ts index 46c3ac2..9a955db 100644 --- a/test/fixtures/ts/4/test.ts +++ b/test/fixtures/ts/4/test.ts @@ -1,12 +1,4 @@ -var test: { - data: { - trueKey: boolean, - falseKey: boolean, - subKey: { - subProp: number - } - } -} = { +var test = { data: { trueKey: true, falseKey: false, @@ -16,9 +8,7 @@ var test: { } }; -var main: { - default: typeof test -} = { +var main = { default: test }; diff --git a/test/fixtures/ts/4/tsconfig.json b/test/fixtures/ts/4/tsconfig.json deleted file mode 100644 index ca687b6..0000000 --- a/test/fixtures/ts/4/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "declaration": false, - "noImplicitAny": false, - "removeComments": true, - "sourceMap": true, - "outDir": ".tmp" - } -} diff --git a/test/fixtures/ts/5/package.json b/test/fixtures/ts/5/package.json deleted file mode 100644 index 5fa8c33..0000000 --- a/test/fixtures/ts/5/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "dependencies": { - "@babel/core": "^7.2.2", - "@babel/preset-env": "^7.2.3", - "@babel/preset-react": "^7.0.0", - "@babel/preset-typescript": "^7.1.0", - "@babel/register": "^7.0.0" - } -} diff --git a/test/fixtures/ts/5/test.ts b/test/fixtures/ts/5/test.ts deleted file mode 100644 index 5c3065b..0000000 --- a/test/fixtures/ts/5/test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Component from "./component" - -var test: typeof Component = { ...Component } - -export default test diff --git a/test/fixtures/ts/6/package.json b/test/fixtures/ts/6/package.json deleted file mode 100644 index b32c446..0000000 --- a/test/fixtures/ts/6/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "esbuild": "^0.14.29", - "esbuild-register": "^3.3.2" - } -} diff --git a/test/fixtures/ts/6/test.ts b/test/fixtures/ts/6/test.ts deleted file mode 100644 index 5bd9e99..0000000 --- a/test/fixtures/ts/6/test.ts +++ /dev/null @@ -1,13 +0,0 @@ -function add(x: number, y: number): number { - return x + y; -} - -export default { - data: { - trueKey: true as boolean, - falseKey: false as boolean, - subKey: { - subProp: add(0.5, 0.5), - }, - }, -}; diff --git a/test/fixtures/ts/7/package.json b/test/fixtures/ts/7/package.json deleted file mode 100644 index e345156..0000000 --- a/test/fixtures/ts/7/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "@swc/core": "^1.2.110", - "@swc/register": "^0.1.7" - } -} diff --git a/test/fixtures/ts/7/test.ts b/test/fixtures/ts/7/test.ts deleted file mode 100644 index 9a955db..0000000 --- a/test/fixtures/ts/7/test.ts +++ /dev/null @@ -1,15 +0,0 @@ -var test = { - data: { - trueKey: true, - falseKey: false, - subKey: { - subProp: 1 - } - } -}; - -var main = { - default: test -}; - -export = main; diff --git a/test/fixtures/tsx/1/package.json b/test/fixtures/tsx/1/package.json index b10f5f1..dc0534c 100644 --- a/test/fixtures/tsx/1/package.json +++ b/test/fixtures/tsx/1/package.json @@ -1,6 +1,5 @@ { "dependencies": { - "typescript": "~1.6.0", - "typescript-node": "^0.1.3" + "sucrase": "^3.12.1" } } diff --git a/test/fixtures/tsx/3/.babelrc b/test/fixtures/tsx/2/.babelrc similarity index 100% rename from test/fixtures/tsx/3/.babelrc rename to test/fixtures/tsx/2/.babelrc diff --git a/test/fixtures/tsx/2/data.tsx b/test/fixtures/tsx/2/data.tsx new file mode 100644 index 0000000..e41be4f --- /dev/null +++ b/test/fixtures/tsx/2/data.tsx @@ -0,0 +1,19 @@ +var test: { + data: { + trueKey: boolean, + falseKey: boolean, + subKey: { + subProp: number + } + } +} = { + data: { + trueKey: true, + falseKey: false, + subKey: { + subProp: 1 + } + } +} + +export default test diff --git a/test/fixtures/tsx/2/package.json b/test/fixtures/tsx/2/package.json index dc0534c..5fa8c33 100644 --- a/test/fixtures/tsx/2/package.json +++ b/test/fixtures/tsx/2/package.json @@ -1,5 +1,9 @@ { "dependencies": { - "sucrase": "^3.12.1" + "@babel/core": "^7.2.2", + "@babel/preset-env": "^7.2.3", + "@babel/preset-react": "^7.0.0", + "@babel/preset-typescript": "^7.1.0", + "@babel/register": "^7.0.0" } } diff --git a/test/fixtures/tsx/2/test.tsx b/test/fixtures/tsx/2/test.tsx index c52e28d..fb1c6d4 100644 --- a/test/fixtures/tsx/2/test.tsx +++ b/test/fixtures/tsx/2/test.tsx @@ -1,3 +1,5 @@ +import data from "./data" + const React = { createElement(Component: () => any) { return Component() @@ -12,7 +14,7 @@ const Component = () => { // Test harmony object short notation. return { data: { trueKey, falseKey, subKey } } -}; +} // Test TSX syntax. -export default +export default diff --git a/test/fixtures/tsx/2/tsconfig.json b/test/fixtures/tsx/2/tsconfig.json deleted file mode 100644 index f108464..0000000 --- a/test/fixtures/tsx/2/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "declaration": false, - "noImplicitAny": false, - "removeComments": true, - "sourceMap": true, - "outDir": ".tmp", - "jsx": "react" - } -} diff --git a/test/fixtures/tsx/3/data.tsx b/test/fixtures/tsx/3/data.tsx index e41be4f..e2af2a8 100644 --- a/test/fixtures/tsx/3/data.tsx +++ b/test/fixtures/tsx/3/data.tsx @@ -1,19 +1,13 @@ -var test: { - data: { - trueKey: boolean, - falseKey: boolean, - subKey: { - subProp: number - } +export const data: { + trueKey: boolean, + falseKey: boolean, + subKey: { + subProp: number } } = { - data: { - trueKey: true, - falseKey: false, - subKey: { - subProp: 1 - } - } -} - -export default test + trueKey: true, + falseKey: false, + subKey: { + subProp: 1, + }, +}; diff --git a/test/fixtures/tsx/3/package.json b/test/fixtures/tsx/3/package.json index 5fa8c33..b32c446 100644 --- a/test/fixtures/tsx/3/package.json +++ b/test/fixtures/tsx/3/package.json @@ -1,9 +1,6 @@ { "dependencies": { - "@babel/core": "^7.2.2", - "@babel/preset-env": "^7.2.3", - "@babel/preset-react": "^7.0.0", - "@babel/preset-typescript": "^7.1.0", - "@babel/register": "^7.0.0" + "esbuild": "^0.14.29", + "esbuild-register": "^3.3.2" } } diff --git a/test/fixtures/tsx/3/test.tsx b/test/fixtures/tsx/3/test.tsx index fb1c6d4..a5581e3 100644 --- a/test/fixtures/tsx/3/test.tsx +++ b/test/fixtures/tsx/3/test.tsx @@ -1,20 +1,11 @@ -import data from "./data" +/** @jsx jsx */ -const React = { - createElement(Component: () => any) { - return Component() - } -} +import { data } from "./data"; -// Test harmony arrow functions. -const Component = () => { - var trueKey: boolean = true - var falseKey: boolean = false - var subKey = { subProp: 1 } +const Component = (props: object) => ({ data: props }); - // Test harmony object short notation. - return { data: { trueKey, falseKey, subKey } } +function jsx(element: typeof Component, props: object) { + return element(props); } -// Test TSX syntax. -export default +export default ; diff --git a/test/fixtures/tsx/5/.swcrc b/test/fixtures/tsx/4/.swcrc similarity index 100% rename from test/fixtures/tsx/5/.swcrc rename to test/fixtures/tsx/4/.swcrc diff --git a/test/fixtures/tsx/4/data.tsx b/test/fixtures/tsx/4/data.tsx deleted file mode 100644 index e2af2a8..0000000 --- a/test/fixtures/tsx/4/data.tsx +++ /dev/null @@ -1,13 +0,0 @@ -export const data: { - trueKey: boolean, - falseKey: boolean, - subKey: { - subProp: number - } -} = { - trueKey: true, - falseKey: false, - subKey: { - subProp: 1, - }, -}; diff --git a/test/fixtures/tsx/4/package.json b/test/fixtures/tsx/4/package.json index b32c446..e345156 100644 --- a/test/fixtures/tsx/4/package.json +++ b/test/fixtures/tsx/4/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "esbuild": "^0.14.29", - "esbuild-register": "^3.3.2" + "@swc/core": "^1.2.110", + "@swc/register": "^0.1.7" } } diff --git a/test/fixtures/tsx/4/test.tsx b/test/fixtures/tsx/4/test.tsx index a5581e3..c52e28d 100644 --- a/test/fixtures/tsx/4/test.tsx +++ b/test/fixtures/tsx/4/test.tsx @@ -1,11 +1,18 @@ -/** @jsx jsx */ - -import { data } from "./data"; +const React = { + createElement(Component: () => any) { + return Component() + } +} -const Component = (props: object) => ({ data: props }); +// Test harmony arrow functions. +const Component = () => { + var trueKey: boolean = true + var falseKey: boolean = false + var subKey = { subProp: 1 } -function jsx(element: typeof Component, props: object) { - return element(props); -} + // Test harmony object short notation. + return { data: { trueKey, falseKey, subKey } } +}; -export default ; +// Test TSX syntax. +export default diff --git a/test/fixtures/tsx/5/package.json b/test/fixtures/tsx/5/package.json deleted file mode 100644 index e345156..0000000 --- a/test/fixtures/tsx/5/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "@swc/core": "^1.2.110", - "@swc/register": "^0.1.7" - } -} diff --git a/test/fixtures/tsx/5/test.tsx b/test/fixtures/tsx/5/test.tsx deleted file mode 100644 index c52e28d..0000000 --- a/test/fixtures/tsx/5/test.tsx +++ /dev/null @@ -1,18 +0,0 @@ -const React = { - createElement(Component: () => any) { - return Component() - } -} - -// Test harmony arrow functions. -const Component = () => { - var trueKey: boolean = true - var falseKey: boolean = false - var subKey = { subProp: 1 } - - // Test harmony object short notation. - return { data: { trueKey, falseKey, subKey } } -}; - -// Test TSX syntax. -export default diff --git a/test/fixtures/wisp/0/package.json b/test/fixtures/wisp/0/package.json deleted file mode 100644 index c061cb9..0000000 --- a/test/fixtures/wisp/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "wisp": "^0.11.1" - } -} diff --git a/test/fixtures/wisp/0/test.wisp b/test/fixtures/wisp/0/test.wisp deleted file mode 100644 index 18c19b4..0000000 --- a/test/fixtures/wisp/0/test.wisp +++ /dev/null @@ -1 +0,0 @@ -(set! module.exports { :data { :falseKey false, :trueKey true, :subKey { :subProp 1 } } }) diff --git a/test/fixtures/xml/0/package.json b/test/fixtures/xml/0/package.json deleted file mode 100644 index c67ec65..0000000 --- a/test/fixtures/xml/0/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "require-xml": "0.0.1" - } -} diff --git a/test/fixtures/xml/0/test.xml b/test/fixtures/xml/0/test.xml deleted file mode 100644 index 17c40d1..0000000 --- a/test/fixtures/xml/0/test.xml +++ /dev/null @@ -1,5 +0,0 @@ - - true - false - - diff --git a/test/fixtures/yaml/0/package.json b/test/fixtures/yaml/0/package.json index af6b878..b46af4b 100644 --- a/test/fixtures/yaml/0/package.json +++ b/test/fixtures/yaml/0/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "require-yaml": "0.0.1" + "yaml-hook": "1.0.0" } } diff --git a/test/fixtures/yml/0/package.json b/test/fixtures/yml/0/package.json index af6b878..b46af4b 100644 --- a/test/fixtures/yml/0/package.json +++ b/test/fixtures/yml/0/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "require-yaml": "0.0.1" + "yaml-hook": "1.0.0" } } diff --git a/test/index.js b/test/index.js index ce6f6fc..e6451a1 100644 --- a/test/index.js +++ b/test/index.js @@ -50,21 +50,15 @@ function cleanup() { // These modules need newer node features var minVersions = { '@babel/register': { major: 6, minor: 0 }, - buble: { major: 4, minor: 0 }, coffeescript: { major: 6, minor: 0 }, - earlgrey: { major: 0, minor: 12 }, esm: { major: 6, minor: 0 }, json5: { major: 6, minor: 0 }, sucrase: { major: 8, minor: 0 }, 'ts-node': { major: 4, minor: 0 }, - wisp: { major: 0, minor: 12 }, - 'require-xml': { major: 6, minor: 0 }, 'toml-require': { major: 6, minor: 0 }, }; -var maxVersions = { - 'typescript-require': { major: 10, minor: 0 }, -}; +var maxVersions = {}; describe('interpret.extensions', function() { @@ -173,41 +167,8 @@ describe('interpret.extensions', function() { }, }, }; - if (module === 'typescript-require') { - // This seems to cause an issue because they vm.runInNewContext so use .toMatch to compare - expect(require(fixture)).toMatch(expected); - } else { - expect(require(fixture)).toEqual(expected); - } - break; - case '.csv': - expected = [['r1c1','r1c2'], ['r2c1','r2c2']]; expect(require(fixture)).toEqual(expected); break; - case '.ini': - expected = { - data: { - trueKey: 'true', - falseKey: 'false', - subKey: { - subProp: '1', - }, - }, - }; - expect(require(fixture)).toEqual(expected); - break; - case '.xml': - expected = { - data: { - trueKey: 'true', - falseKey: 'false', - subKey: { - subProp: '1', - }, - }, - }; - expect(require(fixture)).toEqual(JSON.stringify(expected)); - break; case '.toml': expected = Object.create(null);