From 5fa6d2d504d96a1029b5bc8746fc029ac0ab4143 Mon Sep 17 00:00:00 2001 From: Kevin Marrec Date: Tue, 3 Sep 2019 01:16:39 +0200 Subject: [PATCH 1/7] refactor: use hooks --- jest.config.js | 6 -- packages/typescript-build/lib/module.js | 3 - .../test/fixture/nuxt.config.js | 4 +- packages/typescript-build/test/module.test.js | 3 - packages/typescript-runtime/bin/nuxt-ts.js | 23 +++---- packages/typescript-runtime/lib/args.js | 37 ----------- packages/typescript-runtime/lib/index.js | 24 ++++++- packages/typescript-runtime/lib/register.js | 13 ---- packages/typescript-runtime/lib/resolve.js | 31 --------- packages/typescript-runtime/test/args.test.js | 47 -------------- .../typescript-runtime/test/hooks.test.js | 63 +++++++++++++++++++ .../typescript-runtime/test/register.test.js | 17 ----- .../typescript-runtime/test/resolve.test.js | 5 -- test/setup.js | 12 ---- 14 files changed, 93 insertions(+), 195 deletions(-) delete mode 100644 packages/typescript-runtime/lib/args.js delete mode 100644 packages/typescript-runtime/lib/register.js delete mode 100644 packages/typescript-runtime/lib/resolve.js delete mode 100644 packages/typescript-runtime/test/args.test.js create mode 100644 packages/typescript-runtime/test/hooks.test.js delete mode 100644 packages/typescript-runtime/test/register.test.js delete mode 100644 packages/typescript-runtime/test/resolve.test.js delete mode 100644 test/setup.js diff --git a/jest.config.js b/jest.config.js index 6a0461ed..cd36e86d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -13,12 +13,6 @@ module.exports = { statements: 100 } }, - moduleNameMapper: { - '^~/(.*)$': '/lib/$1', - '^~~$': '', - '^@@$': '', - '^@/(.*)$': '/lib/$1' - }, transform: { '^.+\\.js$': 'babel-jest' } diff --git a/packages/typescript-build/lib/module.js b/packages/typescript-build/lib/module.js index b135e897..3de6d48e 100644 --- a/packages/typescript-build/lib/module.js +++ b/packages/typescript-build/lib/module.js @@ -14,9 +14,6 @@ function tsModule (_moduleOptions) { _moduleOptions ) - // Allow TypeScript extension for severMiddlewares (`nuxt.resolver.resolvePath` uses `options.extensions`) - this.options.extensions.push('ts') - // Extend Builder to handle .ts/.tsx files as routes and watch them this.options.build.additionalExtensions = ['ts', 'tsx'] diff --git a/packages/typescript-build/test/fixture/nuxt.config.js b/packages/typescript-build/test/fixture/nuxt.config.js index 2588c57f..8c0436d3 100644 --- a/packages/typescript-build/test/fixture/nuxt.config.js +++ b/packages/typescript-build/test/fixture/nuxt.config.js @@ -1,5 +1,5 @@ export default { - modules: [ - '../../../packages/typescript-build' + buildModules: [ + '@nuxt/typescript-build' ] } diff --git a/packages/typescript-build/test/module.test.js b/packages/typescript-build/test/module.test.js index 4dd3f0f7..61e68a37 100644 --- a/packages/typescript-build/test/module.test.js +++ b/packages/typescript-build/test/module.test.js @@ -34,9 +34,6 @@ describe('module', () => { test('with default options', async () => { builder = await buildWithTsModule() - expect(builder.nuxt.options.extensions).toHaveLength(3) - expect(builder.nuxt.options.extensions).toEqual(['js', 'mjs', 'ts']) - expect(builder.nuxt.options.build.additionalExtensions).toHaveLength(2) expect(builder.nuxt.options.build.additionalExtensions).toEqual(['ts', 'tsx']) diff --git a/packages/typescript-runtime/bin/nuxt-ts.js b/packages/typescript-runtime/bin/nuxt-ts.js index ee6f26ea..713b50e7 100755 --- a/packages/typescript-runtime/bin/nuxt-ts.js +++ b/packages/typescript-runtime/bin/nuxt-ts.js @@ -1,20 +1,11 @@ #!/usr/bin/env node -const path = require('path') -const { resolveNuxtBin, getRootdirFromArgv, registerTSNode } = require('..') +const cli = (() => { try { return require('@nuxt/cli') } catch { return require('@nuxt/cli-edge') } })() -function main () { - const rootDir = getRootdirFromArgv() - const tsConfigPath = path.resolve(rootDir, 'tsconfig.json') +const { hooks } = require('..') - registerTSNode(tsConfigPath) - - require(resolveNuxtBin()) -} - -try { - main() -} catch (error) { - require('consola').error(error) - process.exit(1) -} +cli.run(null, hooks) + .catch((error) => { + require('consola').fatal(error) + require('exit')(2) + }) diff --git a/packages/typescript-runtime/lib/args.js b/packages/typescript-runtime/lib/args.js deleted file mode 100644 index 40643f6c..00000000 --- a/packages/typescript-runtime/lib/args.js +++ /dev/null @@ -1,37 +0,0 @@ -const path = require('path') -const { tryResolve } = require('./resolve') - -function getCliOptions () { - const cli = ['@nuxt/cli', '@nuxt/cli-edge'].find(cli => tryResolve(cli)) - return Object.entries(require(cli).options) - .reduce((options, [_key, value]) => { - return { ...options, ...value } - }, {}) -} - -function getCliOptionsWithValue () { - return Object.entries(getCliOptions()) - .filter(([_name, { type }]) => type !== 'boolean') - .reduce((optionsWithValue, [name, { alias }]) => { - return [...optionsWithValue, `--${name}`, ...alias ? [`-${alias}`] : []] - }, []) -} - -function getRootdirFromArgv () { - const args = process.argv.slice(2) - const optionsWithValue = getCliOptionsWithValue() - - const isCliOption = (previousArg, currentArg) => { - return ['dev', 'build', 'start', 'generate'].includes(currentArg) || - currentArg[0] === '-' || - (previousArg && previousArg[0] === '-' && optionsWithValue.includes(previousArg)) - } - - const rootDir = args.find((arg, i) => !isCliOption(args[i - 1], arg)) || '.' - - return path.resolve(process.cwd(), rootDir) -} - -module.exports = { - getRootdirFromArgv -} diff --git a/packages/typescript-runtime/lib/index.js b/packages/typescript-runtime/lib/index.js index 5351ee34..2aea2232 100644 --- a/packages/typescript-runtime/lib/index.js +++ b/packages/typescript-runtime/lib/index.js @@ -1,5 +1,23 @@ +const path = require('path') +const { register } = require('ts-node') + +const hooks = { + setup ({ rootDir }) { + rootDir = rootDir || path.resolve(process.cwd(), process.argv[2] || '.') + + register({ + project: path.resolve(rootDir, 'tsconfig.json'), + compilerOptions: { + module: 'commonjs' + } + }) + }, + + config (config) { + config.extensions = [...(config.extensions || []), 'ts'] + } +} + module.exports = { - ...require('./resolve'), - ...require('./args'), - registerTSNode: require('./register') + hooks } diff --git a/packages/typescript-runtime/lib/register.js b/packages/typescript-runtime/lib/register.js deleted file mode 100644 index 55c432d9..00000000 --- a/packages/typescript-runtime/lib/register.js +++ /dev/null @@ -1,13 +0,0 @@ -const { register } = require('ts-node') - -function registerTSNode (tsconfigPath) { - // https://github.com/TypeStrong/ts-node - register({ - project: tsconfigPath, - compilerOptions: { - module: 'commonjs' - } - }) -} - -module.exports = registerTSNode diff --git a/packages/typescript-runtime/lib/resolve.js b/packages/typescript-runtime/lib/resolve.js deleted file mode 100644 index a1c8c67b..00000000 --- a/packages/typescript-runtime/lib/resolve.js +++ /dev/null @@ -1,31 +0,0 @@ -const path = require('path') - -function tryResolve (path) { - try { - return require.resolve(path) - } catch (err) { - return null - } -} - -function resolveNuxtFile (filePath, packages = ['nuxt', 'nuxt-start']) { - packages.push(...packages.map(pkg => pkg + '-edge')) - - for (const pkg of packages) { - const resolvedFile = tryResolve(path.join(pkg, filePath)) - - if (resolvedFile) { - return resolvedFile - } - } -} - -function resolveNuxtBin () { - return resolveNuxtFile('bin/nuxt.js') -} - -module.exports = { - resolveNuxtFile, - resolveNuxtBin, - tryResolve -} diff --git a/packages/typescript-runtime/test/args.test.js b/packages/typescript-runtime/test/args.test.js deleted file mode 100644 index 03b54125..00000000 --- a/packages/typescript-runtime/test/args.test.js +++ /dev/null @@ -1,47 +0,0 @@ -import { resolve } from 'path' -import { getRootdirFromArgv } from '..' - -jest.mock('@nuxt/cli-edge', () => ({ - options: { - ...jest.requireActual('@nuxt/cli-edge').options, - custom: { - withoutAlias: { - type: 'string' - } - } - } -})) - -const argv = process.argv - -describe('getRootdirFromArgv', () => { - let setupArgs - - beforeEach(() => { - setupArgs = (commandLine) => { process.argv = [...argv, ...commandLine.split(' ')] } - }) - - test('nuxt-ts', () => { - expect(getRootdirFromArgv()).toEqual(process.cwd()) - }) - test('nuxt-ts project', () => { - setupArgs('project') - expect(getRootdirFromArgv()).toEqual(resolve(process.cwd(), 'project')) - }) - test('nuxt-ts dev project', () => { - setupArgs('dev project') - expect(getRootdirFromArgv()).toEqual(resolve(process.cwd(), 'project')) - }) - test('nuxt-ts dev -p 3001 project', () => { - setupArgs('dev -p 30001 project') - expect(getRootdirFromArgv()).toEqual(resolve(process.cwd(), 'project')) - }) - test('nuxt-ts dev -p 3001 --analyze project', () => { - setupArgs('dev -p 30001 --analyze project') - expect(getRootdirFromArgv()).toEqual(resolve(process.cwd(), 'project')) - }) - test('nuxt-ts dev --withoutAlias test project', () => { - setupArgs('dev --withoutAlias test project') - expect(getRootdirFromArgv()).toEqual(resolve(process.cwd(), 'project')) - }) -}) diff --git a/packages/typescript-runtime/test/hooks.test.js b/packages/typescript-runtime/test/hooks.test.js new file mode 100644 index 00000000..97f2f51f --- /dev/null +++ b/packages/typescript-runtime/test/hooks.test.js @@ -0,0 +1,63 @@ +import path from 'path' +import { register } from 'ts-node' +import { hooks } from '..' + +jest.mock('ts-node') + +describe('setup hook', () => { + beforeEach(() => { + register.mockClear() + }) + + test('registers ts-node (rootDir: given by CLI)', () => { + hooks.setup({ rootDir: 'path' }) + + expect(register).toHaveBeenCalledWith({ + project: path.resolve('path', 'tsconfig.json'), + compilerOptions: { + module: 'commonjs' + } + }) + }) + + test('registers ts-node (rootDir: process.argv)', () => { + process.argv = ['foo', 'bar', 'path'] + hooks.setup({}) + + expect(register).toHaveBeenCalledWith({ + project: path.resolve('path', 'tsconfig.json'), + compilerOptions: { + module: 'commonjs' + } + }) + }) + test("registers ts-node (rootDir: '.')", () => { + process.argv = ['foo', 'bar'] + hooks.setup({}) + + expect(register).toHaveBeenCalledWith({ + project: path.resolve('tsconfig.json'), + compilerOptions: { + module: 'commonjs' + } + }) + }) +}) + +describe('config hook', () => { + test('adds ts extension (config.extensions is: defined)', () => { + const config = { extensions: [] } + + hooks.config(config) + + expect(config.extensions).toContain('ts') + }) + + test('adds ts extension (config.extensions is: undefined)', () => { + const config = {} + + hooks.config(config) + + expect(config.extensions).toContain('ts') + }) +}) diff --git a/packages/typescript-runtime/test/register.test.js b/packages/typescript-runtime/test/register.test.js deleted file mode 100644 index fc6850d5..00000000 --- a/packages/typescript-runtime/test/register.test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { register } from 'ts-node' -import { registerTSNode } from '..' - -jest.mock('ts-node') - -test('registerTSNode', () => { - const tsConfigPath = 'path/tsconfig.json' - - registerTSNode(tsConfigPath) - - expect(register).toHaveBeenCalledWith({ - project: tsConfigPath, - compilerOptions: { - module: 'commonjs' - } - }) -}) diff --git a/packages/typescript-runtime/test/resolve.test.js b/packages/typescript-runtime/test/resolve.test.js deleted file mode 100644 index 3b6f0fd1..00000000 --- a/packages/typescript-runtime/test/resolve.test.js +++ /dev/null @@ -1,5 +0,0 @@ -import { resolveNuxtBin } from '..' - -test('resolveNuxtBin', () => { - expect(resolveNuxtBin()).toEqual(require.resolve('nuxt-edge/bin/nuxt.js')) -}) diff --git a/test/setup.js b/test/setup.js deleted file mode 100644 index b532703e..00000000 --- a/test/setup.js +++ /dev/null @@ -1,12 +0,0 @@ -import consola from 'consola' -import exit from 'exit' - -consola.mockTypes(() => jest.fn()) - -function errorTrap (error) { - process.stderr.write('\n' + error.stack + '\n') - exit(1) -} - -process.on('unhandledRejection', errorTrap) -process.on('uncaughtException', errorTrap) From 1eeaf5a568cfe3ae531ce918c9684c9aa62ef343 Mon Sep 17 00:00:00 2001 From: Kevin Marrec Date: Thu, 5 Sep 2019 20:55:22 +0200 Subject: [PATCH 2/7] chore(deps): lock file maintenance --- yarn.lock | 187 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 96 insertions(+), 91 deletions(-) diff --git a/yarn.lock b/yarn.lock index bafc2b00..8b71f566 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1763,10 +1763,10 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== -"@nuxt/babel-preset-app-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/babel-preset-app-edge/-/babel-preset-app-edge-2.10.0-26127370.81f0c8af.tgz#2baaa5d55674709e3fe82967b49c1b3a2290966a" - integrity sha512-8W3JnIEtnVCj6V2m9ZodjOh91rf9oWvATsiA+p7fJh9TQVvLJfsmsGFIXlgET7Aovg4rSavXw2prwEWAPpH2XQ== +"@nuxt/babel-preset-app-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/babel-preset-app-edge/-/babel-preset-app-edge-2.10.0-26128283.86179c41.tgz#acf190d365740653e72f766bd7e16be0f3b6d6f1" + integrity sha512-tTiTM6EnJC+MRMDbdNpwVrj02Po329y+kKh02TN9elkYJ/m0Tfu+RF1CmPe54L39LsfDfa3Cgxj49vL+MPsp4A== dependencies: "@babel/core" "^7.5.5" "@babel/plugin-proposal-class-properties" "^7.5.5" @@ -1777,14 +1777,14 @@ "@vue/babel-preset-jsx" "^1.1.0" core-js "^2.6.5" -"@nuxt/builder-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/builder-edge/-/builder-edge-2.10.0-26127370.81f0c8af.tgz#ccdb59f4ab299f6b0fad823b12d87e01eecd8b7b" - integrity sha512-1H++Wh+BclYxUlFqbJDhsjTEbfpoZRBgB62QPDxrD7sQyh9mWqubxf+GbeDMSWsaGj60bd7gV2BMxLFHb3Xn6A== +"@nuxt/builder-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/builder-edge/-/builder-edge-2.10.0-26128283.86179c41.tgz#958080a59791db65185415e7e392d6f8dad52380" + integrity sha512-ByQhvq+O8vajRV2JUy/zUuX9mUetyAsUal5cP/BmWGZ43ZS6mTgWDU/8a+0WYFjfHn8klWg3XMHsgyunQSgSiw== dependencies: "@nuxt/devalue" "^1.2.4" - "@nuxt/utils-edge" "2.10.0-26127370.81f0c8af" - "@nuxt/vue-app-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/utils-edge" "2.10.0-26128283.86179c41" + "@nuxt/vue-app-edge" "2.10.0-26128283.86179c41" chokidar "^3.0.2" consola "^2.10.1" fs-extra "^8.1.0" @@ -1794,16 +1794,16 @@ lodash "^4.17.15" pify "^4.0.1" semver "^6.3.0" - serialize-javascript "^1.9.0" + serialize-javascript "^2.1.0" upath "^1.2.0" -"@nuxt/cli-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/cli-edge/-/cli-edge-2.10.0-26127370.81f0c8af.tgz#cc875346d3c56eb2fcb8835e7699e9ede814bc6d" - integrity sha512-koU2BFUSuhFDDNUC8SCS3oRgNMrMVe4ffGnuYCgrfzGaaMc7szCIl8+6v9DUHdXmyvLX6kAOIAo/4NvJFAKdyg== +"@nuxt/cli-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/cli-edge/-/cli-edge-2.10.0-26128283.86179c41.tgz#021c189814a1eeef9f9690b2d9c5aced6d44b847" + integrity sha512-AmRnEhqohgMKvtcu/oO8zi2y+a7M4mKyPYF7PckVgt4gw2JIdIpZciNATiK/SppBAgw/tn+d3BIoJ1nMGP41rw== dependencies: - "@nuxt/config-edge" "2.10.0-26127370.81f0c8af" - "@nuxt/utils-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/config-edge" "2.10.0-26128283.86179c41" + "@nuxt/utils-edge" "2.10.0-26128283.86179c41" boxen "^4.1.0" chalk "^2.4.2" consola "^2.10.1" @@ -1818,25 +1818,25 @@ std-env "^2.2.1" wrap-ansi "^6.0.0" -"@nuxt/config-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/config-edge/-/config-edge-2.10.0-26127370.81f0c8af.tgz#a99a9c53aa4f31213f7ee3c7d5be1c6976cfdeea" - integrity sha512-L+MnIwZRgEM+UYVVNuHvKJdYzfp7TXGmUtfFjzNJzQFca0Sdrpqsb6S/FC/TQv41JmgH1GvQwSHOAlniav+kQg== +"@nuxt/config-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/config-edge/-/config-edge-2.10.0-26128283.86179c41.tgz#262bb419caab9c9a76a146e1281c5c6eb132d607" + integrity sha512-EdvPPyACDKb4BMRkFya96LUHMM4I1nsN0FCBlloUzvMMYHK5yKzp+fZdf3n6aRNHmNIF+ritpQx8KvYuAa3upg== dependencies: - "@nuxt/utils-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/utils-edge" "2.10.0-26128283.86179c41" consola "^2.10.1" std-env "^2.2.1" -"@nuxt/core-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/core-edge/-/core-edge-2.10.0-26127370.81f0c8af.tgz#c64aba783f9d1eb79d69ba3c3134355b85dbbb5c" - integrity sha512-L70S9gHoCkFanQn6fszDUhPw22wAwLKvQAGIIujvSld4jz6rmZtkCFGS0Y+vlKBViE93E5xZaCXFT9Ous7NE9Q== +"@nuxt/core-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/core-edge/-/core-edge-2.10.0-26128283.86179c41.tgz#784b1b0578edfc0433c1bceba32824637bbbaec5" + integrity sha512-z7IArCwrz8vNAypKCFr7SwdOmlrtqyVc6DryJDI6x2zllZkEcxa0CBTIMSIY+AycAUsJrkWFvarWTD6I6ffeZA== dependencies: - "@nuxt/config-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/config-edge" "2.10.0-26128283.86179c41" "@nuxt/devalue" "^1.2.4" - "@nuxt/server-edge" "2.10.0-26127370.81f0c8af" - "@nuxt/utils-edge" "2.10.0-26127370.81f0c8af" - "@nuxt/vue-renderer-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/server-edge" "2.10.0-26128283.86179c41" + "@nuxt/utils-edge" "2.10.0-26128283.86179c41" + "@nuxt/vue-renderer-edge" "2.10.0-26128283.86179c41" consola "^2.10.1" debug "^4.1.1" esm "^3.2.25" @@ -1862,12 +1862,12 @@ error-stack-parser "^2.0.0" string-width "^2.0.0" -"@nuxt/generator-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/generator-edge/-/generator-edge-2.10.0-26127370.81f0c8af.tgz#ee59a855db3be791c0b32e0b7bf62c0430fbe0ce" - integrity sha512-a8X3CNH4BpVioSlrcxUjZW31f/rTKuNTWWAuiKzx74rCuDBH3XH0YpcOmRsJpo8WRX+isdCqRD5wuXGthglbWg== +"@nuxt/generator-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/generator-edge/-/generator-edge-2.10.0-26128283.86179c41.tgz#415a224fe063914e9cf4e29633de6deb9014cb13" + integrity sha512-u6H/IjL3KmjATyN82ftw9hU2893Yz+zWSQGYsmVKGv0Ki8Y3g9nruglmy5e508krzIblw/K8CmYCX6PVde6FWQ== dependencies: - "@nuxt/utils-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/utils-edge" "2.10.0-26128283.86179c41" chalk "^2.4.2" consola "^2.10.1" fs-extra "^8.1.0" @@ -1892,13 +1892,13 @@ consola "^2.10.1" node-fetch "^2.6.0" -"@nuxt/server-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/server-edge/-/server-edge-2.10.0-26127370.81f0c8af.tgz#52bf720f2797d5c97a1622d7c1b9c89596a72555" - integrity sha512-f6f/qThHDwJPRI5Rl0RVi2FGinIEO04+B7xaOvkpCtcLViqOW4pDMLJ9l0p7L4CFUN4owv3fPJmYq34hl1leZg== +"@nuxt/server-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/server-edge/-/server-edge-2.10.0-26128283.86179c41.tgz#7431b04a09ca4b77a1806adde630bca49a90e185" + integrity sha512-Gt+RnkNLAAMSVzx0PXGafq/M5fTPUgNmuj1lzuAwxBONzht07NUBq9be6bK8kim7OHBYbfzYjeoHPOYMtc+Acw== dependencies: - "@nuxt/config-edge" "2.10.0-26127370.81f0c8af" - "@nuxt/utils-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/config-edge" "2.10.0-26128283.86179c41" + "@nuxt/utils-edge" "2.10.0-26128283.86179c41" "@nuxtjs/youch" "^4.2.3" chalk "^2.4.2" compression "^1.7.4" @@ -1915,24 +1915,24 @@ serve-static "^1.14.1" server-destroy "^1.0.1" -"@nuxt/utils-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/utils-edge/-/utils-edge-2.10.0-26127370.81f0c8af.tgz#ae98b6dfccd80408ed706e429bc5e79a4d391e2c" - integrity sha512-Gza1x9VX11btw+VqjADyVUAYLEeYEGBB/fECfj/9uBdmeH3H6znP7MFS0hFFVBU2nduES/7xfzU9yfqaVcwrWw== +"@nuxt/utils-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/utils-edge/-/utils-edge-2.10.0-26128283.86179c41.tgz#5e7244bbd9deef3db40e8d2d0d0a07960851580d" + integrity sha512-fkuXkUg4pfGhLuVaRQLqQC6LYyZwfshuiLs33nhTeT05kDQ87CyEZahhOtEUZ7h2tezI2dLJziAqzURS10dyRg== dependencies: consola "^2.10.1" fs-extra "^8.1.0" hash-sum "^2.0.0" proper-lockfile "^4.1.1" semver "^6.3.0" - serialize-javascript "^1.9.0" + serialize-javascript "^2.1.0" signal-exit "^3.0.2" ua-parser-js "^0.7.20" -"@nuxt/vue-app-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/vue-app-edge/-/vue-app-edge-2.10.0-26127370.81f0c8af.tgz#d8a9c9abbb2ccbfbe0a5f33c8ba2c72e05dae11f" - integrity sha512-VUXrLfm270C0agfq4jDWeyeJdfc2OGqnwSJEs6FiI7yxlu1e5D2A0KFZzl+oFfVsJ28zbcjlGX3fYaahyqzdWg== +"@nuxt/vue-app-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/vue-app-edge/-/vue-app-edge-2.10.0-26128283.86179c41.tgz#09346a29dfe25e66084ef09c315290156bcc8385" + integrity sha512-qFUcCzMpVtjHMGb9xZdoWq8N4wYtYo3LWMrQUTo82VoRp3I6iWfDOFQXwc1tLzLKaKBytelo73roNeVLKCmphA== dependencies: node-fetch "^2.6.0" unfetch "^4.1.0" @@ -1944,13 +1944,13 @@ vue-template-compiler "^2.6.10" vuex "^3.1.1" -"@nuxt/vue-renderer-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/vue-renderer-edge/-/vue-renderer-edge-2.10.0-26127370.81f0c8af.tgz#982956ce395af34bc81921f69825cdbda355397a" - integrity sha512-XXW6xVoZR/wSoAbKKB/qrtsMCks0mWV/SBSu3SI3Ylznos+tRqsiCBM9yXmgVUgSBqagJee0xV2w874ppXUw1A== +"@nuxt/vue-renderer-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/vue-renderer-edge/-/vue-renderer-edge-2.10.0-26128283.86179c41.tgz#7a223ec3e8c80b08f695cf860b71f5c2cd67562b" + integrity sha512-I9FUvLyhA6BLWkJEStetirE0D4PVahchx4bxRWfsUhkjKfmeToy4icN1X2Df3jm0p/w+7tG/gfuy6c/oJj/3yg== dependencies: "@nuxt/devalue" "^1.2.4" - "@nuxt/utils-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/utils-edge" "2.10.0-26128283.86179c41" consola "^2.10.1" fs-extra "^8.1.0" lru-cache "^5.1.1" @@ -1958,15 +1958,15 @@ vue-meta "^2.2.2" vue-server-renderer "^2.6.10" -"@nuxt/webpack-edge@2.10.0-26127370.81f0c8af": - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/@nuxt/webpack-edge/-/webpack-edge-2.10.0-26127370.81f0c8af.tgz#bf7c9937b5821f81538e7691dcc5c3c9a5c3e3cf" - integrity sha512-mAz0Wb0rv3zdSJn4KOiOHhJwYO7o5toGeeWf2JjXg+JzzSC+DgL2Yh3O8mCYMvYG8g2Y+JwwKljiJ4iu5SBhfA== +"@nuxt/webpack-edge@2.10.0-26128283.86179c41": + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/@nuxt/webpack-edge/-/webpack-edge-2.10.0-26128283.86179c41.tgz#80207938c5c2db81b5f7ffa4bf2e70eece1cbef3" + integrity sha512-c24d390eYCLCANMHUiid/TosTKqQSLZJuFvXc43pTO5MMul7EJA5Uo6Rvk9rrnB2claQ7/9SFjc5hdFADVVYaQ== dependencies: "@babel/core" "^7.5.5" - "@nuxt/babel-preset-app-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/babel-preset-app-edge" "2.10.0-26128283.86179c41" "@nuxt/friendly-errors-webpack-plugin" "^2.5.0" - "@nuxt/utils-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/utils-edge" "2.10.0-26128283.86179c41" babel-loader "^8.0.6" cache-loader "^4.1.0" caniuse-lite "^1.0.30000989" @@ -2294,9 +2294,9 @@ integrity sha1-a9p9uGU/piZD9e5p6facEaOS46Y= "@types/semver@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.0.1.tgz#a984b405c702fa5a7ec6abc56b37f2ba35ef5af6" - integrity sha512-ffCdcrEE5h8DqVxinQjo+2d1q+FV5z7iNtPofw3JsrltSoSVlOGaW0rY8XxtO9XukdTn8TaCGWmk2VFGhI70mg== + version "6.0.2" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.0.2.tgz#5e8b09f0e4af53034b1d0fb9977a277847836205" + integrity sha512-G1Ggy7/9Nsa1Jt2yiBR2riEuyK2DFNnqow6R7cromXPMNynackRY1vqFTLz/gwnef1LHokbXThcPhqMRjUbkpQ== "@types/serve-static@*", "@types/serve-static@^1.13.3": version "1.13.3" @@ -2383,9 +2383,9 @@ source-map "^0.6.0" "@types/yargs-parser@*": - version "13.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.0.0.tgz#453743c5bbf9f1bed61d959baab5b06be029b2d0" - integrity sha512-wBlsw+8n21e6eTd4yVv8YD/E3xq0O6nNnJIquutAsFGE7EyMKz7W6RNT6BRu1SmdgmlCZ9tb0X+j+D6HGr8pZw== + version "13.1.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" + integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg== "@types/yargs@^13.0.0": version "13.0.2" @@ -4473,10 +4473,10 @@ currently-unhandled@^0.4.1: dependencies: array-find-index "^1.0.1" -cyclist@~0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" - integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA= +cyclist@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" + integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= dargs@^4.0.1: version "4.1.0" @@ -5058,9 +5058,9 @@ eslint-plugin-import@^2.18.0: resolve "^1.11.0" eslint-plugin-jest@^22.10.0: - version "22.16.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.16.0.tgz#30c4e0e9dc331beb2e7369b70dd1363690c1ce05" - integrity sha512-eBtSCDhO1k7g3sULX/fuRK+upFQ7s548rrBtxDyM1fSoY7dTWp/wICjrJcDZKVsW7tsFfH22SG+ZaxG5BZodIg== + version "22.17.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.17.0.tgz#dc170ec8369cd1bff9c5dd8589344e3f73c88cf6" + integrity sha512-WT4DP4RoGBhIQjv+5D0FM20fAdAUstfYAf/mkufLNTojsfgzc5/IYW22cIg/Q4QBavAZsROQlqppiWDpFZDS8Q== dependencies: "@typescript-eslint/experimental-utils" "^1.13.0" @@ -7622,9 +7622,9 @@ lodash@^4.15.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17. integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== loglevel@^1.6.2: - version "1.6.3" - resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.3.tgz#77f2eb64be55a404c9fd04ad16d57c1d6d6b1280" - integrity sha512-LoEDv5pgpvWgPF4kNYuIp0qqSJVWak/dML0RY74xlzMZiT9w77teNAwKYKWBTYjlokMirg+o3jBwp+vlLrcfAA== + version "1.6.4" + resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.4.tgz#f408f4f006db8354d0577dcf6d33485b3cb90d56" + integrity sha512-p0b6mOGKcGa+7nnmKbpzR6qloPbrgLcnio++E+14Vo/XffOGwZtRpUhr8dTH/x2oCMmEoIU0Zwm3ZauhvYD17g== loose-envify@^1.0.0: version "1.4.0" @@ -8424,17 +8424,17 @@ number-is-nan@^1.0.0: integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= nuxt-edge@latest: - version "2.10.0-26127370.81f0c8af" - resolved "https://registry.yarnpkg.com/nuxt-edge/-/nuxt-edge-2.10.0-26127370.81f0c8af.tgz#0ded538c2aa9db1db241e525500dd2b158481a04" - integrity sha512-6auVOANY3Fy7xnWIx1gt1BTxXK6JGoFzcERuNTgckH/1CdZBpVMc/bVLZkBqO4rabrVCKHJxtScMS2jhST9YRA== - dependencies: - "@nuxt/builder-edge" "2.10.0-26127370.81f0c8af" - "@nuxt/cli-edge" "2.10.0-26127370.81f0c8af" - "@nuxt/core-edge" "2.10.0-26127370.81f0c8af" - "@nuxt/generator-edge" "2.10.0-26127370.81f0c8af" + version "2.10.0-26128283.86179c41" + resolved "https://registry.yarnpkg.com/nuxt-edge/-/nuxt-edge-2.10.0-26128283.86179c41.tgz#cb7007e070125bfb6e3fab8e6b02334aee9a34ea" + integrity sha512-eVrybuvnx7pPtn53Im038EsJKBT67gxODEwwJEaUGtLap65NDiY7ll69T1UqsmfUCOfM8jSysJonQJeiTf8rSA== + dependencies: + "@nuxt/builder-edge" "2.10.0-26128283.86179c41" + "@nuxt/cli-edge" "2.10.0-26128283.86179c41" + "@nuxt/core-edge" "2.10.0-26128283.86179c41" + "@nuxt/generator-edge" "2.10.0-26128283.86179c41" "@nuxt/loading-screen" "^1.0.1" "@nuxt/opencollective" "^0.3.0" - "@nuxt/webpack-edge" "2.10.0-26127370.81f0c8af" + "@nuxt/webpack-edge" "2.10.0-26128283.86179c41" nwsapi@^2.0.7: version "2.1.4" @@ -8742,11 +8742,11 @@ pako@~1.0.5: integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw== parallel-transform@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.1.0.tgz#d410f065b05da23081fcd10f28854c29bda33b06" - integrity sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY= + version "1.2.0" + resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.2.0.tgz#9049ca37d6cb2182c3b1d2c720be94d14a5814fc" + integrity sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg== dependencies: - cyclist "~0.2.2" + cyclist "^1.0.1" inherits "^2.0.3" readable-stream "^2.1.5" @@ -10541,11 +10541,16 @@ send@0.17.1: range-parser "~1.2.1" statuses "~1.5.0" -serialize-javascript@^1.3.0, serialize-javascript@^1.7.0, serialize-javascript@^1.9.0: +serialize-javascript@^1.3.0, serialize-javascript@^1.7.0: version "1.9.1" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.9.1.tgz#cfc200aef77b600c47da9bb8149c943e798c2fdb" integrity sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A== +serialize-javascript@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.0.tgz#9310276819efd0eb128258bb341957f6eb2fc570" + integrity sha512-a/mxFfU00QT88umAJQsNWOnUKckhNCqOl028N48e7wFmo2/EHpTo9Wso+iJJCMrQnmFvcjto5RJdAHEvVhcyUQ== + serve-placeholder@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/serve-placeholder/-/serve-placeholder-1.2.1.tgz#3659fca99b0f15fb3bdf0a72917a6d1848786e9c" From cd6c08ef5bc806bdbefd7785530f4b22cd6235a8 Mon Sep 17 00:00:00 2001 From: Kevin Marrec Date: Thu, 5 Sep 2019 21:58:24 +0200 Subject: [PATCH 3/7] chore: finalize hooks --- packages/typescript-runtime/lib/index.js | 7 ++++--- .../typescript-runtime/test/hooks.test.js | 21 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/typescript-runtime/lib/index.js b/packages/typescript-runtime/lib/index.js index 2aea2232..b59fc55b 100644 --- a/packages/typescript-runtime/lib/index.js +++ b/packages/typescript-runtime/lib/index.js @@ -2,11 +2,12 @@ const path = require('path') const { register } = require('ts-node') const hooks = { - setup ({ rootDir }) { - rootDir = rootDir || path.resolve(process.cwd(), process.argv[2] || '.') + 'run:before' ({ argv, rootDir }) { + const customPath = argv.find((_arg, index) => index > 0 && argv[index - 1] === '--tsconfig') + const tsConfigPath = path.resolve(customPath || rootDir, customPath && customPath.endsWith('.json') ? '' : 'tsconfig.json') register({ - project: path.resolve(rootDir, 'tsconfig.json'), + project: tsConfigPath, compilerOptions: { module: 'commonjs' } diff --git a/packages/typescript-runtime/test/hooks.test.js b/packages/typescript-runtime/test/hooks.test.js index 97f2f51f..b4eed012 100644 --- a/packages/typescript-runtime/test/hooks.test.js +++ b/packages/typescript-runtime/test/hooks.test.js @@ -4,13 +4,13 @@ import { hooks } from '..' jest.mock('ts-node') -describe('setup hook', () => { +describe('run:before hook', () => { beforeEach(() => { register.mockClear() }) - test('registers ts-node (rootDir: given by CLI)', () => { - hooks.setup({ rootDir: 'path' }) + test('registers ts-node', () => { + hooks['run:before']({ rootDir: 'path' }) expect(register).toHaveBeenCalledWith({ project: path.resolve('path', 'tsconfig.json'), @@ -20,23 +20,22 @@ describe('setup hook', () => { }) }) - test('registers ts-node (rootDir: process.argv)', () => { - process.argv = ['foo', 'bar', 'path'] - hooks.setup({}) + test('registers ts-node (custom tsconfig.json path)', () => { + hooks['run:before']({ argv: ['--tsconfig', 'custom/tsconfig.json'], rootDir: 'path' }) expect(register).toHaveBeenCalledWith({ - project: path.resolve('path', 'tsconfig.json'), + project: path.resolve('custom/tsconfig.json'), compilerOptions: { module: 'commonjs' } }) }) - test("registers ts-node (rootDir: '.')", () => { - process.argv = ['foo', 'bar'] - hooks.setup({}) + + test('registers ts-node (custom tsconfig.json dir path)', () => { + hooks['run:before']({ argv: ['--tsconfig', 'custom'], rootDir: 'path' }) expect(register).toHaveBeenCalledWith({ - project: path.resolve('tsconfig.json'), + project: path.resolve('custom/tsconfig.json'), compilerOptions: { module: 'commonjs' } From cddf4de2aafdc13f6ede6c654a2897a463dadf64 Mon Sep 17 00:00:00 2001 From: Kevin Marrec Date: Thu, 5 Sep 2019 22:23:49 +0200 Subject: [PATCH 4/7] fix: tests --- packages/typescript-runtime/test/hooks.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-runtime/test/hooks.test.js b/packages/typescript-runtime/test/hooks.test.js index b4eed012..c56c86e6 100644 --- a/packages/typescript-runtime/test/hooks.test.js +++ b/packages/typescript-runtime/test/hooks.test.js @@ -10,7 +10,7 @@ describe('run:before hook', () => { }) test('registers ts-node', () => { - hooks['run:before']({ rootDir: 'path' }) + hooks['run:before']({ argv: [], rootDir: 'path' }) expect(register).toHaveBeenCalledWith({ project: path.resolve('path', 'tsconfig.json'), From 78b129672b2dcdbf347c4bb3a03ca16d388dd1c1 Mon Sep 17 00:00:00 2001 From: Kevin Marrec Date: Mon, 30 Sep 2019 20:53:01 +0200 Subject: [PATCH 5/7] refactor: migrate codebase to typescript (#122) * chore: init typescript codebase migration * refactor: migrate runtime to typescript * chore: add build script --- jest.config.js | 18 +++-- package.json | 2 + packages/types/cli/index.d.ts | 8 ++ packages/types/config/build.d.ts | 6 ++ packages/types/config/module.d.ts | 14 +++- packages/typescript-build/lib/module.js | 63 --------------- packages/typescript-build/package.json | 10 ++- packages/typescript-build/src/index.ts | 81 +++++++++++++++++++ .../test/{module.test.js => module.test.ts} | 5 +- packages/typescript-build/tsconfig.json | 11 +++ packages/typescript-runtime/package.json | 9 ++- .../{lib/index.js => src/index.ts} | 11 +-- .../test/{hooks.test.js => hooks.test.ts} | 17 ++-- packages/typescript-runtime/tsconfig.json | 10 +++ tsconfig.json | 15 ++++ tsconfig.test.json | 17 ++++ yarn.lock | 53 ++++++++---- 17 files changed, 247 insertions(+), 103 deletions(-) create mode 100644 packages/types/cli/index.d.ts delete mode 100644 packages/typescript-build/lib/module.js create mode 100644 packages/typescript-build/src/index.ts rename packages/typescript-build/test/{module.test.js => module.test.ts} (96%) create mode 100644 packages/typescript-build/tsconfig.json rename packages/typescript-runtime/{lib/index.js => src/index.ts} (57%) rename packages/typescript-runtime/test/{hooks.test.js => hooks.test.ts} (70%) create mode 100644 packages/typescript-runtime/tsconfig.json create mode 100644 tsconfig.json create mode 100644 tsconfig.test.json diff --git a/jest.config.js b/jest.config.js index cd36e86d..e422b9dc 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,9 +1,20 @@ module.exports = { testEnvironment: 'node', + transform: { + '^.+\\.ts$': 'ts-jest', + '^.+\\.js$': 'babel-jest' + }, + globals: { + 'ts-jest': { + tsConfig: 'tsconfig.test.json', + diagnostics: { + ignoreCodes: [2345] + } + } + }, collectCoverage: true, - coverageDirectory: './coverage', collectCoverageFrom: [ - 'packages/*/lib/**/*.js' + 'packages/*/src/**/*.ts' ], coverageThreshold: { global: { @@ -12,8 +23,5 @@ module.exports = { lines: 100, statements: 100 } - }, - transform: { - '^.+\\.js$': 'babel-jest' } } diff --git a/package.json b/package.json index 0f671ce5..6304b596 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ ], "scripts": { "dev": "nuxt-ts", + "build": "lerna run build", "lint": "eslint --ext .ts,.tsx,.js,.vue .", "lint:fix": "yarn lint --fix", "test": "yarn lint && yarn test:unit && yarn test:types", @@ -23,6 +24,7 @@ "jest": "latest", "lerna": "latest", "nuxt-edge": "latest", + "ts-jest": "latest", "typescript": "~3.6", "vue-property-decorator": "latest" } diff --git a/packages/types/cli/index.d.ts b/packages/types/cli/index.d.ts new file mode 100644 index 00000000..9eaa4c65 --- /dev/null +++ b/packages/types/cli/index.d.ts @@ -0,0 +1,8 @@ +import { Configuration } from '../config' + +type Command = any // TBD + +export interface Hooks { + config?(config: Configuration): void + 'run:before'?(params: { argv: string [], command: Command, rootDir: string }): void +} diff --git a/packages/types/config/build.d.ts b/packages/types/config/build.d.ts index 927f9cb2..4918a749 100644 --- a/packages/types/config/build.d.ts +++ b/packages/types/config/build.d.ts @@ -30,6 +30,11 @@ interface NuxtBabelOptions extends Pick PluginItem[] | void) | PluginItem[] | null } +interface Warning { + message: string + name: string +} + export interface NuxtConfigurationBuild { additionalExtensions?: string[] analyze?: BundleAnalyzerPlugin.Options | boolean @@ -74,5 +79,6 @@ export interface NuxtConfigurationBuild { templates?: any terser?: TerserPluginOptions | boolean transpile?: (string | RegExp)[] + warningIgnoreFilters?: Array<(warn: Warning) => boolean> watch?: string[] } diff --git a/packages/types/config/module.d.ts b/packages/types/config/module.d.ts index 0ad61872..266abdb4 100644 --- a/packages/types/config/module.d.ts +++ b/packages/types/config/module.d.ts @@ -5,10 +5,22 @@ */ import { Configuration as WebpackConfiguration } from 'webpack' +import { NuxtConfigurationLoaders } from './build' import { Configuration as NuxtConfiguration } from '.' +interface ExtendFunctionContext { + isClient: boolean + isDev: boolean + isLegacy: boolean + isModern: boolean + isServer: boolean + loaders: NuxtConfigurationLoaders +} + +type ExtendFunction = (config: WebpackConfiguration, ctx: ExtendFunctionContext) => void + interface ModuleThis { - extendBuild(fn: (config: WebpackConfiguration) => void): void + extendBuild(fn: ExtendFunction): void options: NuxtConfiguration nuxt: any // TBD [key: string]: any // TBD diff --git a/packages/typescript-build/lib/module.js b/packages/typescript-build/lib/module.js deleted file mode 100644 index 3de6d48e..00000000 --- a/packages/typescript-build/lib/module.js +++ /dev/null @@ -1,63 +0,0 @@ -const path = require('path') -const consola = require('consola') - -const defaults = { - ignoreNotFoundWarnings: false, - typeCheck: true -} - -function tsModule (_moduleOptions) { - // Combine options - const moduleOptions = Object.assign( - defaults, - this.options.typescript, - _moduleOptions - ) - - // Extend Builder to handle .ts/.tsx files as routes and watch them - this.options.build.additionalExtensions = ['ts', 'tsx'] - - if (moduleOptions.ignoreNotFoundWarnings) { - this.options.build.warningIgnoreFilters.push(warn => - warn.name === 'ModuleDependencyWarning' && /export .* was not found in /.test(warn.message) - ) - } - - this.extendBuild((config, { isClient, isModern }) => { - config.resolve.extensions.push('.ts', '.tsx') - - const jsxRule = config.module.rules.find(r => r.test.test('.jsx')) - const babelLoader = jsxRule.use[jsxRule.use.length - 1] - - config.module.rules.push(...['ts', 'tsx'].map(ext => - ({ - test: new RegExp(`\\.${ext}$`, 'i'), - use: [ - babelLoader, - { - loader: 'ts-loader', - options: { - transpileOnly: true, - [`append${ext.charAt(0).toUpperCase() + ext.slice(1)}SuffixTo`]: [/\.vue$/], - ...(moduleOptions.loaders && moduleOptions.loaders[ext]) - } - } - ] - }) - )) - - if (moduleOptions.typeCheck && isClient && !isModern) { - const ForkTsCheckerWebpackPlugin = require(this.nuxt.resolver.resolveModule('fork-ts-checker-webpack-plugin')) - config.plugins.push(new ForkTsCheckerWebpackPlugin(Object.assign({ - vue: true, - tsconfig: path.resolve(this.options.rootDir, 'tsconfig.json'), - tslint: false, // We recommend using ESLint so we set this option to `false` by default - formatter: 'codeframe', - logger: consola.withScope('nuxt:typescript') - }, moduleOptions.typeCheck))) - } - }) -} - -module.exports = tsModule -module.exports.meta = require('../package.json') diff --git a/packages/typescript-build/package.json b/packages/typescript-build/package.json index 555363ee..4e575f0e 100644 --- a/packages/typescript-build/package.json +++ b/packages/typescript-build/package.json @@ -5,9 +5,15 @@ "repository": "nuxt/typescript", "license": "MIT", "files": [ - "lib" + "dist" ], - "main": "lib/module.js", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "yarn run clean && yarn compile", + "clean": "rm -rf dist", + "compile": "tsc" + }, "dependencies": { "@nuxt/types": "0.2.15", "consola": "^2.10.1", diff --git a/packages/typescript-build/src/index.ts b/packages/typescript-build/src/index.ts new file mode 100644 index 00000000..b0a89b3d --- /dev/null +++ b/packages/typescript-build/src/index.ts @@ -0,0 +1,81 @@ +import path from 'path' +import consola from 'consola' +import { Module } from '@nuxt/types' +import { Options as TsLoaderOptions } from 'ts-loader' +import { Options as TsCheckerOptions } from 'fork-ts-checker-webpack-plugin' +import { RuleSetUseItem } from 'webpack' + +declare module '@nuxt/types' { + interface Configuration { + typescript?: Options + } +} + +export interface Options { + ignoreNotFoundWarnings?: boolean + loaders?: { + ts?: TsLoaderOptions + tsx?: TsLoaderOptions + } + typeCheck?: TsCheckerOptions | boolean +} + +const defaults: Options = { + ignoreNotFoundWarnings: false, + typeCheck: true +} + +const tsModule: Module = function (moduleOptions) { + // Combine options + const options = Object.assign( + defaults, + this.options.typescript, + moduleOptions + ) + + // Extend Builder to handle .ts/.tsx files as routes and watch them + this.options.build!.additionalExtensions = ['ts', 'tsx'] + + if (options.ignoreNotFoundWarnings) { + this.options.build!.warningIgnoreFilters!.push(warn => + warn.name === 'ModuleDependencyWarning' && /export .* was not found in /.test(warn.message) + ) + } + + this.extendBuild((config, { isClient, isModern }) => { + config.resolve!.extensions!.push('.ts', '.tsx') + + const jsxRuleLoaders = config.module!.rules.find(r => (r.test as RegExp).test('.jsx'))!.use as RuleSetUseItem[] + const babelLoader = jsxRuleLoaders[jsxRuleLoaders.length - 1] + + config.module!.rules.push(...(['ts', 'tsx'] as const).map(ext => + ({ + test: new RegExp(`\\.${ext}$`, 'i'), + use: [ + babelLoader, + { + loader: 'ts-loader', + options: { + transpileOnly: true, + [`append${ext.charAt(0).toUpperCase() + ext.slice(1)}SuffixTo`]: [/\.vue$/], + ...(options.loaders && options.loaders[ext]) + } + } + ] + }) + )) + + if (options.typeCheck && isClient && !isModern) { + const ForkTsCheckerWebpackPlugin = require(this.nuxt.resolver.resolveModule('fork-ts-checker-webpack-plugin')) + config.plugins!.push(new ForkTsCheckerWebpackPlugin(Object.assign({ + vue: true, + tsconfig: path.resolve(this.options.rootDir!, 'tsconfig.json'), + tslint: false, // We recommend using ESLint so we set this option to `false` by default + formatter: 'codeframe', + logger: consola.withScope('nuxt:typescript') + }, options.typeCheck))) + } + }) +} + +export default tsModule diff --git a/packages/typescript-build/test/module.test.js b/packages/typescript-build/test/module.test.ts similarity index 96% rename from packages/typescript-build/test/module.test.js rename to packages/typescript-build/test/module.test.ts index 61e68a37..e59b59b1 100644 --- a/packages/typescript-build/test/module.test.js +++ b/packages/typescript-build/test/module.test.ts @@ -4,12 +4,12 @@ import { Nuxt } from '@nuxt/core-edge' import { Builder } from '@nuxt/builder-edge' import { BundleBuilder } from '@nuxt/webpack-edge' -import tsModule from '..' +import tsModule from '../src' jest.setTimeout(60000) jest.mock('fork-ts-checker-webpack-plugin') -const buildWithTsModule = async (config) => { +const buildWithTsModule = async (config = {}) => { const nuxt = new Nuxt({ build: { warningIgnoreFilters: [] @@ -28,6 +28,7 @@ describe('module', () => { let builder beforeEach(() => { + // @ts-ignore ForkTsCheckerWebpackPlugin.mockClear() }) diff --git a/packages/typescript-build/tsconfig.json b/packages/typescript-build/tsconfig.json new file mode 100644 index 00000000..c1bfc40e --- /dev/null +++ b/packages/typescript-build/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "declaration": true, + "sourceMap": true + }, + "include": [ + "src/**/*" + ] +} diff --git a/packages/typescript-runtime/package.json b/packages/typescript-runtime/package.json index 7d0ae446..c635b3c1 100644 --- a/packages/typescript-runtime/package.json +++ b/packages/typescript-runtime/package.json @@ -6,13 +6,18 @@ "license": "MIT", "files": [ "bin", - "lib" + "dist" ], "bin": { "nuxt-ts": "bin/nuxt-ts.js", "nuxts": "bin/nuxt-ts.js" }, - "main": "lib/index.js", + "main": "dist/index.js", + "scripts": { + "build": "yarn run clean && yarn compile", + "clean": "rm -rf dist", + "compile": "tsc" + }, "dependencies": { "@nuxt/types": "0.2.15", "ts-node": "^8.4.1", diff --git a/packages/typescript-runtime/lib/index.js b/packages/typescript-runtime/src/index.ts similarity index 57% rename from packages/typescript-runtime/lib/index.js rename to packages/typescript-runtime/src/index.ts index b59fc55b..abe16811 100644 --- a/packages/typescript-runtime/lib/index.js +++ b/packages/typescript-runtime/src/index.ts @@ -1,10 +1,11 @@ -const path = require('path') -const { register } = require('ts-node') +import { resolve } from 'path' +import { register } from 'ts-node' +import { Hooks } from '@nuxt/types/cli' -const hooks = { +const hooks: Hooks = { 'run:before' ({ argv, rootDir }) { const customPath = argv.find((_arg, index) => index > 0 && argv[index - 1] === '--tsconfig') - const tsConfigPath = path.resolve(customPath || rootDir, customPath && customPath.endsWith('.json') ? '' : 'tsconfig.json') + const tsConfigPath = resolve(customPath || rootDir, customPath && customPath.endsWith('.json') ? '' : 'tsconfig.json') register({ project: tsConfigPath, @@ -19,6 +20,6 @@ const hooks = { } } -module.exports = { +export { hooks } diff --git a/packages/typescript-runtime/test/hooks.test.js b/packages/typescript-runtime/test/hooks.test.ts similarity index 70% rename from packages/typescript-runtime/test/hooks.test.js rename to packages/typescript-runtime/test/hooks.test.ts index c56c86e6..b1773333 100644 --- a/packages/typescript-runtime/test/hooks.test.js +++ b/packages/typescript-runtime/test/hooks.test.ts @@ -1,16 +1,17 @@ import path from 'path' import { register } from 'ts-node' -import { hooks } from '..' +import { Configuration as NuxtConfiguration } from '@nuxt/types' +import { hooks } from '../src' jest.mock('ts-node') describe('run:before hook', () => { beforeEach(() => { - register.mockClear() + jest.clearAllMocks() }) test('registers ts-node', () => { - hooks['run:before']({ argv: [], rootDir: 'path' }) + hooks['run:before']!({ argv: [], command: null, rootDir: 'path' }) expect(register).toHaveBeenCalledWith({ project: path.resolve('path', 'tsconfig.json'), @@ -21,7 +22,7 @@ describe('run:before hook', () => { }) test('registers ts-node (custom tsconfig.json path)', () => { - hooks['run:before']({ argv: ['--tsconfig', 'custom/tsconfig.json'], rootDir: 'path' }) + hooks['run:before']!({ argv: ['--tsconfig', 'custom/tsconfig.json'], command: null, rootDir: 'path' }) expect(register).toHaveBeenCalledWith({ project: path.resolve('custom/tsconfig.json'), @@ -32,7 +33,7 @@ describe('run:before hook', () => { }) test('registers ts-node (custom tsconfig.json dir path)', () => { - hooks['run:before']({ argv: ['--tsconfig', 'custom'], rootDir: 'path' }) + hooks['run:before']!({ argv: ['--tsconfig', 'custom'], command: null, rootDir: 'path' }) expect(register).toHaveBeenCalledWith({ project: path.resolve('custom/tsconfig.json'), @@ -47,15 +48,15 @@ describe('config hook', () => { test('adds ts extension (config.extensions is: defined)', () => { const config = { extensions: [] } - hooks.config(config) + hooks.config!(config) expect(config.extensions).toContain('ts') }) test('adds ts extension (config.extensions is: undefined)', () => { - const config = {} + const config: NuxtConfiguration = {} - hooks.config(config) + hooks.config!(config) expect(config.extensions).toContain('ts') }) diff --git a/packages/typescript-runtime/tsconfig.json b/packages/typescript-runtime/tsconfig.json new file mode 100644 index 00000000..cfbb5b5a --- /dev/null +++ b/packages/typescript-runtime/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "dist" + }, + "include": [ + "src/**/*" + ] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..a2716e4e --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "esnext", + "lib": ["dom", "esnext"], + "module": "esnext", + "moduleResolution": "node", + "skipLibCheck": true, + "esModuleInterop": true, + "strict": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "stripInternal": true, + "noUnusedLocals": true + } +} diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 00000000..6129aaa9 --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "esnext", + "lib": ["dom", "esnext"], + "module": "esnext", + "moduleResolution": "node", + "skipLibCheck": true, + "esModuleInterop": true, + "strict": true, + "noImplicitAny": false, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "stripInternal": true, + "noUnusedLocals": true + }, + "include": ["packages/*/test/**/*.ts"] +} diff --git a/yarn.lock b/yarn.lock index a326e1ec..939de21d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3440,6 +3440,13 @@ browserslist@^4.0.0, browserslist@^4.6.0, browserslist@^4.6.3, browserslist@^4.6 electron-to-chromium "^1.3.247" node-releases "^1.1.29" +bs-logger@0.x: + version "0.2.6" + resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" + integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== + dependencies: + fast-json-stable-stringify "2.x" + bser@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.0.tgz#65fc784bf7f87c009b973c12db6546902fa9c7b5" @@ -3452,7 +3459,7 @@ btoa-lite@^1.0.0: resolved "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337" integrity sha1-M3dm2hWAEhD92VbCLpxokaudAzc= -buffer-from@^1.0.0: +buffer-from@1.x, buffer-from@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== @@ -5501,7 +5508,7 @@ fast-glob@^2.2.6: merge2 "^1.2.3" micromatch "^3.1.10" -fast-json-stable-stringify@^2.0.0: +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= @@ -7335,6 +7342,13 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= +json5@2.x, json5@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" + integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== + dependencies: + minimist "^1.2.0" + json5@^0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" @@ -7347,13 +7361,6 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" -json5@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" - integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== - dependencies: - minimist "^1.2.0" - jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -7610,7 +7617,7 @@ lodash.kebabcase@^4.0.1, lodash.kebabcase@^4.1.1: resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY= -lodash.memoize@^4.1.2: +lodash.memoize@4.x, lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= @@ -7747,7 +7754,7 @@ make-dir@^3.0.0: dependencies: semver "^6.0.0" -make-error@^1.1.1: +make-error@1.x, make-error@^1.1.1: version "1.3.5" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== @@ -8116,7 +8123,7 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: +mkdirp@*, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= @@ -10423,7 +10430,7 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: +resolve@1.x, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.0, resolve@^1.2.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: version "1.12.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== @@ -10597,7 +10604,7 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= -"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: +"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -11575,6 +11582,22 @@ tryer@^1.0.1: resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA== +ts-jest@latest: + version "24.1.0" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-24.1.0.tgz#2eaa813271a2987b7e6c3fefbda196301c131734" + integrity sha512-HEGfrIEAZKfu1pkaxB9au17b1d9b56YZSqz5eCVE8mX68+5reOvlM93xGOzzCREIov9mdH7JBG+s0UyNAqr0tQ== + dependencies: + bs-logger "0.x" + buffer-from "1.x" + fast-json-stable-stringify "2.x" + json5 "2.x" + lodash.memoize "4.x" + make-error "1.x" + mkdirp "0.x" + resolve "1.x" + semver "^5.5" + yargs-parser "10.x" + ts-loader@^6.1.2: version "6.1.2" resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.1.2.tgz#ff6bc767334970226438949fbde2e211147a1325" @@ -12410,7 +12433,7 @@ yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.0.tgz#906cc2100972dc2625ae78f566a2577230a1d6f7" integrity sha512-6gpP93MR+VOOehKbCPchro3wFZNSNmek8A2kbkOAZLIZAYx1KP/zAqwO0sOHi3xJEb+UBz8NaYt/17UNit1Q9w== -yargs-parser@^10.0.0: +yargs-parser@10.x, yargs-parser@^10.0.0: version "10.1.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== From 9f15382dd741a454f896bb5a66891f421288388a Mon Sep 17 00:00:00 2001 From: Kevin Marrec Date: Mon, 30 Sep 2019 21:37:02 +0200 Subject: [PATCH 6/7] chore(deps): lock file maintenance --- yarn.lock | 258 ++++++++++++++++++++++++++---------------------------- 1 file changed, 123 insertions(+), 135 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9b742c30..aa8dabd4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1762,10 +1762,10 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== -"@nuxt/babel-preset-app-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/babel-preset-app-edge/-/babel-preset-app-edge-2.10.0-26159050.686720f0.tgz#5dfa9d4a9103093a7665365e2222e7d5646d1971" - integrity sha512-Hf93O/RGxV6DWg2tyiKWOOkf+MuXBEaaZsnBoe+tBcuj3Bq8BPmrgmxGzLbCOYuu4HeX6EMH1h+EQdJQwZyqbA== +"@nuxt/babel-preset-app-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/babel-preset-app-edge/-/babel-preset-app-edge-2.10.0-26164163.37bdf749.tgz#521ae9806b1159c393faec2aab88d59b979821ca" + integrity sha512-ture9SEixBzsyGiOPtrvOi3YggMivHBabCyTcrpXhOZg0uaCde2zVj3H5QQ65qVbWO9L7lEHIqr1surmy3M3+g== dependencies: "@babel/core" "^7.6.2" "@babel/plugin-proposal-class-properties" "^7.5.5" @@ -1776,14 +1776,14 @@ "@vue/babel-preset-jsx" "^1.1.0" core-js "^2.6.5" -"@nuxt/builder-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/builder-edge/-/builder-edge-2.10.0-26159050.686720f0.tgz#26b9cd5d2ec012e1525a7da93386b3c19ad41396" - integrity sha512-juDGeNuDRsE8NpChnAw7kMbtApJKVZSY/Mpoc5vOiNvWCP1LpKGgsoRnpYUK7S5U1MH7N5Mn6iUZynjycjvusQ== +"@nuxt/builder-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/builder-edge/-/builder-edge-2.10.0-26164163.37bdf749.tgz#930dd196c5dbb6d2ce0f4b43a42babdf957b2b7f" + integrity sha512-df64mBe38O4dzPGFy+f1J06B+qSo/H3o57Kq+5FmHzF2eW8uc5+Vcwb9eQipBKwO39Izr2YJSRDBblS9XyYyow== dependencies: "@nuxt/devalue" "^1.2.4" - "@nuxt/utils-edge" "2.10.0-26159050.686720f0" - "@nuxt/vue-app-edge" "2.10.0-26159050.686720f0" + "@nuxt/utils-edge" "2.10.0-26164163.37bdf749" + "@nuxt/vue-app-edge" "2.10.0-26164163.37bdf749" chokidar "^3.1.1" consola "^2.10.1" fs-extra "^8.1.0" @@ -1796,13 +1796,13 @@ serialize-javascript "^2.1.0" upath "^1.2.0" -"@nuxt/cli-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/cli-edge/-/cli-edge-2.10.0-26159050.686720f0.tgz#e28ac487ec5a40c4fe4456813eb0eb0dc547d347" - integrity sha512-MF6zg2YJiKLuBRCzJJvrGGYPvn/Ju4diUUyKHTrCGdCQi58+KN5RfriAuDgoczQuAsWfx5B38im8jmEhQWg1bw== +"@nuxt/cli-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/cli-edge/-/cli-edge-2.10.0-26164163.37bdf749.tgz#1b5c9fd2498ae39f6c095c529d79cc6a31018ca6" + integrity sha512-+kgTXIOLjlFVp5O5GDexdohKQFNyWJ66kgjZEHq/fvYKkBA2aNE9xWr5N2X18prMkhn5yr9DEhKLcmlkOc+YLQ== dependencies: - "@nuxt/config-edge" "2.10.0-26159050.686720f0" - "@nuxt/utils-edge" "2.10.0-26159050.686720f0" + "@nuxt/config-edge" "2.10.0-26164163.37bdf749" + "@nuxt/utils-edge" "2.10.0-26164163.37bdf749" boxen "^4.1.0" chalk "^2.4.2" consola "^2.10.1" @@ -1817,25 +1817,25 @@ std-env "^2.2.1" wrap-ansi "^6.0.0" -"@nuxt/config-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/config-edge/-/config-edge-2.10.0-26159050.686720f0.tgz#1c64350d901accd4319268ee30fd866555e43877" - integrity sha512-TRUBb4O2KFdhqEYYoXpPRheQLe4Wr/9/LvIDhyY0XN6YST/VMro/Qxq99q5n3gr8yp4aCIPp0ZC7uPD/gYRjTw== +"@nuxt/config-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/config-edge/-/config-edge-2.10.0-26164163.37bdf749.tgz#02c08c799288d19c3c7e67bd9d7ec98110bf77dc" + integrity sha512-VOMvpAgolrv5uR6O70hr/ViAm04X//vtuRNKDJw++u8zZ5Ra3IdPTKMLPMlK/zO/LPwz94PqXnwd/1piJEZLlA== dependencies: - "@nuxt/utils-edge" "2.10.0-26159050.686720f0" + "@nuxt/utils-edge" "2.10.0-26164163.37bdf749" consola "^2.10.1" std-env "^2.2.1" -"@nuxt/core-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/core-edge/-/core-edge-2.10.0-26159050.686720f0.tgz#a8f601e5472ec700012467ed9df584b1c4ff22fc" - integrity sha512-39MviBiV82ZQvduz5vi+RErONCwp44Wns6Nyw7ZTiEjBfuWhnjLtDanG8513gwCVNcZ8cP403zjICnNZMoNpFw== +"@nuxt/core-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/core-edge/-/core-edge-2.10.0-26164163.37bdf749.tgz#379bcb9d34cf6773a0058391645dbe05fc528315" + integrity sha512-8YlteC6VNnpvdqBWXgwNzW9lwJV6phmK9moYhAilPdnMXda/uOwP5jfM8sm32dmwoTI0mFi22r1SaWjIQiHaRw== dependencies: - "@nuxt/config-edge" "2.10.0-26159050.686720f0" + "@nuxt/config-edge" "2.10.0-26164163.37bdf749" "@nuxt/devalue" "^1.2.4" - "@nuxt/server-edge" "2.10.0-26159050.686720f0" - "@nuxt/utils-edge" "2.10.0-26159050.686720f0" - "@nuxt/vue-renderer-edge" "2.10.0-26159050.686720f0" + "@nuxt/server-edge" "2.10.0-26164163.37bdf749" + "@nuxt/utils-edge" "2.10.0-26164163.37bdf749" + "@nuxt/vue-renderer-edge" "2.10.0-26164163.37bdf749" consola "^2.10.1" debug "^4.1.1" esm "^3.2.25" @@ -1861,12 +1861,12 @@ error-stack-parser "^2.0.0" string-width "^2.0.0" -"@nuxt/generator-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/generator-edge/-/generator-edge-2.10.0-26159050.686720f0.tgz#07853629b489bbc9c56aca684688ec57b3b1b06e" - integrity sha512-c9n3jCkrYXi2uoEFiwE4lBV1Gj3y5oFeil1xAZyLRONC//V9Ofzs2Mv7RFrVPzqgtj57+OZ6kHdX6wmXrhQBGA== +"@nuxt/generator-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/generator-edge/-/generator-edge-2.10.0-26164163.37bdf749.tgz#f635b8f0967bdae839948c39677c683f8f6c7af1" + integrity sha512-U8q4OBQGA73dbiyItN7653j8a1hIwD1rGvznk17nIqEoaTYXnoC7QWqqDTnOSzW4MPqWidadeHzo0mghkIHMJA== dependencies: - "@nuxt/utils-edge" "2.10.0-26159050.686720f0" + "@nuxt/utils-edge" "2.10.0-26164163.37bdf749" chalk "^2.4.2" consola "^2.10.1" fs-extra "^8.1.0" @@ -1891,13 +1891,13 @@ consola "^2.10.1" node-fetch "^2.6.0" -"@nuxt/server-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/server-edge/-/server-edge-2.10.0-26159050.686720f0.tgz#4648a5a146c0c781937cefb11da7832d5785a40d" - integrity sha512-WMvcTc8zSqrNMmxZJ3SUL742AQ1WK1sfQBH0wRwWVFF3Ws9zbLGh16JnI2PhfvuaM3mGyNi+qVNwvBrbw9c72w== +"@nuxt/server-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/server-edge/-/server-edge-2.10.0-26164163.37bdf749.tgz#e12dcc281e92fc1e2d587ea41defac3c3e6c22da" + integrity sha512-2GzVVxRCY+KGuuuHGCLBF6i3J4bV+PaMrNSpOhg7wzftJYTBGhH17BCUNLQwMkTKBGZD+WuwNAA9VBQ8wqYCBQ== dependencies: - "@nuxt/config-edge" "2.10.0-26159050.686720f0" - "@nuxt/utils-edge" "2.10.0-26159050.686720f0" + "@nuxt/config-edge" "2.10.0-26164163.37bdf749" + "@nuxt/utils-edge" "2.10.0-26164163.37bdf749" "@nuxtjs/youch" "^4.2.3" chalk "^2.4.2" compression "^1.7.4" @@ -1914,10 +1914,10 @@ serve-static "^1.14.1" server-destroy "^1.0.1" -"@nuxt/utils-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/utils-edge/-/utils-edge-2.10.0-26159050.686720f0.tgz#d0c8cc405444428362a666cd4d605768e6c025ba" - integrity sha512-SFJi2pVFsH+h1YbqrVeiydE9E+uFTcLeGnGLz/zbYHHCbrT4u/Z+nnaGQ6R/kDhep04fEj7+HIBi+lE1MyifvA== +"@nuxt/utils-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/utils-edge/-/utils-edge-2.10.0-26164163.37bdf749.tgz#cbf7256746d1a6b3619e8b48392dfbea7284c359" + integrity sha512-FF9eSfhETMvJVsDrAkIkZNXjTpRQ7stYWtU7wI/Id0Fqr/Jw7A3+r6jrblvr+VqhkCM0vo+mrU+uQyxeMOlraQ== dependencies: consola "^2.10.1" fs-extra "^8.1.0" @@ -1928,10 +1928,10 @@ signal-exit "^3.0.2" ua-parser-js "^0.7.20" -"@nuxt/vue-app-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/vue-app-edge/-/vue-app-edge-2.10.0-26159050.686720f0.tgz#3025790864eb0f644d3a758d2e73f2c95b85f5fa" - integrity sha512-uW7mlWCCVNT5Aa6ZQND38eo97ye7VAqaWJX2v6HwMeIH1Izh6i6WHbzUkIxIAeLXHPQ9W5VW+W7QGPafpgR/8Q== +"@nuxt/vue-app-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/vue-app-edge/-/vue-app-edge-2.10.0-26164163.37bdf749.tgz#c9966f211a7b2f946f11d1958e939412ad52e4a5" + integrity sha512-4WQofvLl7yVhj+iWlf+NUjsa6hBT1vN1hH/4VzOczINEcM9AAuZ1qM4nU4z/sJLVFsr+uzNV9OokX1aDayYumA== dependencies: node-fetch "^2.6.0" unfetch "^4.1.0" @@ -1943,13 +1943,13 @@ vue-template-compiler "^2.6.10" vuex "^3.1.1" -"@nuxt/vue-renderer-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/vue-renderer-edge/-/vue-renderer-edge-2.10.0-26159050.686720f0.tgz#ab3f3503c1efe65f898853803f224cdab2628f53" - integrity sha512-i+0j+GA8NRhP+zHtqSSINNEO7v7ib8EdZ40h01ULeOXXzCqidey021z3WW1hoDeE9MNxoAZnwI5SkMpwsvEnMA== +"@nuxt/vue-renderer-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/vue-renderer-edge/-/vue-renderer-edge-2.10.0-26164163.37bdf749.tgz#aa25eb50d804d970eb4621f35307cc9012c47b3d" + integrity sha512-ib3NTbU6i3iPKaotqtSY1mjv6LhB05cseQKSkLmBVVkIVtvlTxcEXwlpYOp0XnYQ0TcIzmcJMn4MEQee5cHMxw== dependencies: "@nuxt/devalue" "^1.2.4" - "@nuxt/utils-edge" "2.10.0-26159050.686720f0" + "@nuxt/utils-edge" "2.10.0-26164163.37bdf749" consola "^2.10.1" fs-extra "^8.1.0" lru-cache "^5.1.1" @@ -1957,15 +1957,15 @@ vue-meta "^2.2.2" vue-server-renderer "^2.6.10" -"@nuxt/webpack-edge@2.10.0-26159050.686720f0": - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/@nuxt/webpack-edge/-/webpack-edge-2.10.0-26159050.686720f0.tgz#787e718d7597c27c6fcdf72dc116f927b37fd166" - integrity sha512-LwizqLTDNuIsCNiVklPhBIQXhlSPOddldN++/OLUpbvfCpFVsFjVW4yvukdzcSmIaFrD5PNDyBvgxHj+lUIZIA== +"@nuxt/webpack-edge@2.10.0-26164163.37bdf749": + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/@nuxt/webpack-edge/-/webpack-edge-2.10.0-26164163.37bdf749.tgz#33e88d217d59bf62b311eb21436feeeaf1fea4bf" + integrity sha512-+NjVmn/xQgIxuTgQleJa5lheZVBA4A6MNYHaX/Qo7hA92rX0CYBMNDcOtTpmYk8jYMoJ6wuRuss1IiRUge2/cg== dependencies: "@babel/core" "^7.6.2" - "@nuxt/babel-preset-app-edge" "2.10.0-26159050.686720f0" + "@nuxt/babel-preset-app-edge" "2.10.0-26164163.37bdf749" "@nuxt/friendly-errors-webpack-plugin" "^2.5.0" - "@nuxt/utils-edge" "2.10.0-26159050.686720f0" + "@nuxt/utils-edge" "2.10.0-26164163.37bdf749" babel-loader "^8.0.6" cache-loader "^4.1.0" caniuse-lite "^1.0.30000997" @@ -1992,14 +1992,14 @@ semver "^6.3.0" std-env "^2.2.1" style-resources-loader "^1.2.1" - terser-webpack-plugin "^2.1.0" + terser-webpack-plugin "^2.1.2" thread-loader "^2.1.3" time-fix-plugin "^2.0.6" url-loader "^2.1.0" vue-loader "^15.7.1" webpack "^4.41.0" webpack-bundle-analyzer "^3.5.2" - webpack-dev-middleware "^3.7.1" + webpack-dev-middleware "^3.7.2" webpack-hot-middleware "^2.25.0" webpack-node-externals "^1.7.2" webpackbar "^4.0.0" @@ -2370,19 +2370,7 @@ "@types/source-list-map" "*" source-map "^0.6.1" -"@types/webpack@*": - version "4.39.1" - resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.39.1.tgz#d76cd551cc851198f67f75ff3e26551d204530e9" - integrity sha512-rgO9ihNu/l72Sjx3shqwc9r6gi+tOMsqxhMEZhOEVIZt82GFOeUyEdpTk1BO2HqEHLS/XJW8ldUTIIfIMMyYFQ== - dependencies: - "@types/anymatch" "*" - "@types/node" "*" - "@types/tapable" "*" - "@types/uglify-js" "*" - "@types/webpack-sources" "*" - source-map "^0.6.0" - -"@types/webpack@^4.39.2": +"@types/webpack@*", "@types/webpack@^4.39.2": version "4.39.2" resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.39.2.tgz#fcaa85607a9bdd0e8f86a350f239ff08aede8584" integrity sha512-3c7+vcmyyIi3RBoOdXs8k3E9rQVIy6yOBqK0DFk6lnJ76JUfbDBWbEf1JflzyPQf56W4ToE+2YPnbxbucniW5w== @@ -2407,23 +2395,23 @@ "@types/yargs-parser" "*" "@typescript-eslint/eslint-plugin@^2.2.0": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.3.1.tgz#b0b1e6b9b3f84b3e1afbdd338f4194c8ab92db21" - integrity sha512-VqVNEsvemviajlaWm03kVMabc6S3xCHGYuY0fReTrIIOZg+3WzB+wfw6fD3KYKerw5lYxmzogmHOZ0i7YKnuwA== + version "2.3.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.3.2.tgz#7e112ca0bb29044d915baf10163a8199a20f7c69" + integrity sha512-tcnpksq1bXzcIRbYLeXkgp6l+ggEMXXUcl1wsSvL807fRtmvVQKygElwEUf4hBA76dNag3VAK1q2m3vd7qJaZA== dependencies: - "@typescript-eslint/experimental-utils" "2.3.1" + "@typescript-eslint/experimental-utils" "2.3.2" eslint-utils "^1.4.2" functional-red-black-tree "^1.0.1" regexpp "^2.0.1" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@2.3.1": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.3.1.tgz#92f2531d3e7c22e64a2cc10cfe89935deaf00f7c" - integrity sha512-FaZEj73o4h6Wd0Lg+R4pZiJGdR0ZYbJr+O2+RbQ1aZjX8bZcfkVDtD+qm74Dv77rfSKkDKE64UTziLBo9UYHQA== +"@typescript-eslint/experimental-utils@2.3.2": + version "2.3.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.3.2.tgz#e50f31264507e6fec7b33840bb6af260c24f4ea8" + integrity sha512-t+JGdTT6dRbmvKDlhlVkEueoZa0fhJNfG6z2cpnRPLwm3VwYr2BjR//acJGC1Yza0I9ZNcDfRY7ubQEvvfG6Jg== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "2.3.1" + "@typescript-eslint/typescript-estree" "2.3.2" eslint-scope "^5.0.0" "@typescript-eslint/experimental-utils@^1.13.0": @@ -2436,13 +2424,13 @@ eslint-scope "^4.0.0" "@typescript-eslint/parser@^2.2.0": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.3.1.tgz#f2b93b614d9b338825c44e75552a433e2ebf8c33" - integrity sha512-ZlWdzhCJ2iZnSp/VBAJ/sowFbyHycIux8t0UEH0JsKgQvfSf7949hLYFMwTXdCMeEnpP1zRTHimrR+YHzs8LIw== + version "2.3.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.3.2.tgz#e9b742e191cd1209930da469cde379591ad0af5b" + integrity sha512-nq1UQeNGdKdqdgF6Ww+Ov2OidWgiL96+JYdXXZ2rkP/OWyc6KMNSbs6MpRCpI8q+PmDa7hBnHNQIo7w/drYccA== dependencies: "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "2.3.1" - "@typescript-eslint/typescript-estree" "2.3.1" + "@typescript-eslint/experimental-utils" "2.3.2" + "@typescript-eslint/typescript-estree" "2.3.2" eslint-visitor-keys "^1.1.0" "@typescript-eslint/typescript-estree@1.13.0": @@ -2453,10 +2441,10 @@ lodash.unescape "4.0.1" semver "5.5.0" -"@typescript-eslint/typescript-estree@2.3.1": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.3.1.tgz#62c64f149948473d06a129dc33b4fc76e6c051f9" - integrity sha512-9SFhUgFuePJBB6jlLkOPPhMkZNiDCr+S8Ft7yAkkP2c5x5bxPhG3pe/exMiQaF8IGyVMDW6Ul0q4/cZ+uF3uog== +"@typescript-eslint/typescript-estree@2.3.2": + version "2.3.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.3.2.tgz#107414aa04e689fe6f7251eb63fb500217f2b7f4" + integrity sha512-eZNEAai16nwyhIVIEaWQlaUgAU3S9CkQ58qvK0+3IuSdLJD3W1PNuehQFMIhW/mTP1oFR9GNoTcLg7gtXz6lzA== dependencies: glob "^7.1.4" is-glob "^4.0.1" @@ -3955,9 +3943,9 @@ commander@2.17.x: integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== commander@^2.18.0, commander@^2.19.0, commander@^2.20.0, commander@~2.20.0: - version "2.20.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" - integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== + version "2.20.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.1.tgz#3863ce3ca92d0831dcf2a102f5fb4b5926afd0f9" + integrity sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg== commander@~2.19.0: version "2.19.0" @@ -4906,9 +4894,9 @@ ejs@^2.6.1: integrity sha512-kS/gEPzZs3Y1rRsbGX4UOSjtP/CeJP0CxSNZHYxGfVM/VgLcv0ZqM7C45YyTj2DI2g7+P9Dd24C+IMIg6D0nYQ== electron-to-chromium@^1.3.247: - version "1.3.267" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.267.tgz#7745ff9d447fd2a9802e1c6dfa518631e0cf5357" - integrity sha512-9Q2ixAJC+oHjWNtJV0MQ4vJMCWSowIrC6V6vcr+bwPddTDHj2ddv9xxXCzf4jT/fy6HP7maPoW0gifXkRxCttQ== + version "1.3.269" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.269.tgz#3e00cc9266a0123fc2e7b4f290899e257200e6e3" + integrity sha512-t2ZTfo07HxkxTOUbIwMmqHBSnJsC9heqJUm7LwQu2iSk0wNhG4H5cMREtb8XxeCrQABDZ6IqQKY3yZq+NfAqwg== elliptic@^6.0.0: version "6.5.1" @@ -5213,9 +5201,9 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== eslint@latest: - version "6.4.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.4.0.tgz#5aa9227c3fbe921982b2eda94ba0d7fae858611a" - integrity sha512-WTVEzK3lSFoXUovDHEbkJqCVPEPwbhCq4trDktNI6ygs7aO41d4cDT0JFAT5MivzZeVLWlg7vHL+bgrQv/t3vA== + version "6.5.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.5.0.tgz#304623eec903969dd5c9f2d61c6ce3d6ecec8750" + integrity sha512-IIbSW+vKOqMatPmS9ayyku4tvWxHY2iricSRtOz6+ZA5IPRlgXzEL0u/j6dr4eha0ugmhMwDTqxtmNu3kj9O4w== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -6021,9 +6009,9 @@ hable@^2.3.2: integrity sha512-qJ9WoXl/15LNlG1KeAuBjCNGStUb+MCQ5biPxOmwRyESH8CSWwZB4xEnzCduuQ3I/mlgui28t8/oMAGT1Rpb2g== handlebars@^4.1.2: - version "4.3.3" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.3.3.tgz#56dd05fe33d6bd8a7d797351c39a0cdcfd576be5" - integrity sha512-VupOxR91xcGojfINrzMqrvlyYbBs39sXIrWa7YdaQWeBudOlvKEGvCczMfJPgnuwHE/zyH1M6J+IUP6cgDVyxg== + version "4.4.0" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.4.0.tgz#22e1a897c5d83023d39801f35f6b65cf97ed8b25" + integrity sha512-xkRtOt3/3DzTKMOt3xahj2M/EqNhY988T+imYSlMgs5fVhLN2fmKVVj0LtEGmb+3UUYV5Qmm1052Mm3dIQxOvw== dependencies: neo-async "^2.6.0" optimist "^0.6.1" @@ -6326,9 +6314,9 @@ humanize-ms@^1.2.1: ms "^2.0.0" husky@latest: - version "3.0.5" - resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.5.tgz#d7db27c346645a8dc52df02aa534a377ad7925e0" - integrity sha512-cKd09Jy9cDyNIvAdN2QQAP/oA21sle4FWXjIMDttailpLAYZuBE7WaPmhrkj+afS8Sj9isghAtFvWSQ0JiwOHg== + version "3.0.7" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.7.tgz#05e869006c7d9a31b27893aeda520e730bd125b9" + integrity sha512-fIrkaREoQk6DO8KnSX16Aq7Kg9SxqYYQZH/9b+4AxXyXNNgpJLsc8lWlQCShLus1nbujIyZ/WQZBHGwClohK/w== dependencies: chalk "^2.4.2" cosmiconfig "^5.2.1" @@ -8369,9 +8357,9 @@ node-pre-gyp@^0.12.0: tar "^4" node-releases@^1.1.29: - version "1.1.32" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.32.tgz#485b35c1bf9b4d8baa105d782f8ca731e518276e" - integrity sha512-VhVknkitq8dqtWoluagsGPn3dxTvN9fwgR59fV3D7sLBHe0JfDramsMI8n8mY//ccq/Kkrf8ZRHRpsyVZ3qw1A== + version "1.1.33" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.33.tgz#349f10291234624574f44cf32b7de259bf028303" + integrity sha512-I0V30bWQEoHb+10W8oedVoUrdjW5wIkYm0w7vvcrPO95pZY738m1k77GF5sO0vKg5eXYg9oGtrMAETbgZGm11A== dependencies: semver "^5.3.0" @@ -8531,17 +8519,17 @@ number-is-nan@^1.0.0: integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= nuxt-edge@latest: - version "2.10.0-26159050.686720f0" - resolved "https://registry.yarnpkg.com/nuxt-edge/-/nuxt-edge-2.10.0-26159050.686720f0.tgz#75ff2b630fa829fb9e15f56e67266c0a8205af7b" - integrity sha512-ypFfahgiIPGgg6mTGeKWJdItUBD7ETZKiG9elgfa0GyObTy5afPtiuUz1mrHA9VlFK1DJnuZxME7JJPGVKeMNw== - dependencies: - "@nuxt/builder-edge" "2.10.0-26159050.686720f0" - "@nuxt/cli-edge" "2.10.0-26159050.686720f0" - "@nuxt/core-edge" "2.10.0-26159050.686720f0" - "@nuxt/generator-edge" "2.10.0-26159050.686720f0" + version "2.10.0-26164163.37bdf749" + resolved "https://registry.yarnpkg.com/nuxt-edge/-/nuxt-edge-2.10.0-26164163.37bdf749.tgz#28fd76995c359b84f42e22169550d5df87abec2a" + integrity sha512-FBiCl5aGMpItO8oUbWw9tBdKOY09igwg2IFvkvvYmyTjPFQlczKxXUxqr2xOTq0GE0yCA+XYpfIww4c2/sB7sQ== + dependencies: + "@nuxt/builder-edge" "2.10.0-26164163.37bdf749" + "@nuxt/cli-edge" "2.10.0-26164163.37bdf749" + "@nuxt/core-edge" "2.10.0-26164163.37bdf749" + "@nuxt/generator-edge" "2.10.0-26164163.37bdf749" "@nuxt/loading-screen" "^1.1.0" "@nuxt/opencollective" "^0.3.0" - "@nuxt/webpack-edge" "2.10.0-26159050.686720f0" + "@nuxt/webpack-edge" "2.10.0-26164163.37bdf749" nwsapi@^2.0.7: version "2.1.4" @@ -10041,9 +10029,9 @@ rc@^1.2.7: strip-json-comments "~2.0.1" react-is@^16.8.4: - version "16.10.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.0.tgz#3d6a031e57fff73c3cfa0347feb3e8f40c5141e5" - integrity sha512-WRki2sBb7MTpYp7FtDEmSeGKX2vamYyq3rc9o7fKUG+/DHVyJu69NnvJsiSwwhh2Tt8XN40MQHkDBEXwyfxncQ== + version "16.10.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.1.tgz#0612786bf19df406502d935494f0450b40b8294f" + integrity sha512-BXUMf9sIOPXXZWqr7+c5SeOKJykyVr2u0UDzEf4LNGc6taGkQe1A9DFD07umCIXz45RLr9oAAwZbAJ0Pkknfaw== read-cache@^1.0.0: version "1.0.0" @@ -11360,10 +11348,10 @@ terser-webpack-plugin@^1.4.1: webpack-sources "^1.4.0" worker-farm "^1.7.0" -terser-webpack-plugin@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.1.1.tgz#ce84a39124bff59b56895642dd803e73bfca007f" - integrity sha512-JhKx1aWtb0woicUwG7VJgunyNigRDKgeriOgh1bAZVSwu3raBuP/jTF9zpFWwoLzuTaoj0TwxcK/nA/PauEe+A== +terser-webpack-plugin@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.1.2.tgz#2b9b8147a6f18918348200800cf9560c50f701bb" + integrity sha512-MF/C4KABwqYOfRDi87f7gG07GP7Wj/kyiX938UxIGIO6l5mkh8XJL7xtS0hX/CRdVQaZI7ThGUPZbznrCjsGpg== dependencies: cacache "^13.0.0" find-cache-dir "^3.0.0" @@ -11371,7 +11359,7 @@ terser-webpack-plugin@^2.1.0: schema-utils "^2.4.1" serialize-javascript "^2.1.0" source-map "^0.6.1" - terser "^4.3.3" + terser "^4.3.4" webpack-sources "^1.4.3" terser@^3.16.1: @@ -11383,10 +11371,10 @@ terser@^3.16.1: source-map "~0.6.1" source-map-support "~0.5.10" -terser@^4.1.2, terser@^4.3.3: - version "4.3.3" - resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.3.tgz#f626c6779cadd60a3018e072fedeceabe4769db1" - integrity sha512-Nzr7dpRjSzMEUS+z2UYQBtzE0LDm5k0Yy8RgLRPy85QUo1TjU5lIOBwzS5/FVAMaVyHZ3WTTU2BuQcMn8KXnNQ== +terser@^4.1.2, terser@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.4.tgz#ad91bade95619e3434685d69efa621a5af5f877d" + integrity sha512-Kcrn3RiW8NtHBP0ssOAzwa2MsIRQ8lJWiBG/K7JgqPlomA3mtb2DEmp4/hrUA+Jujx+WZ02zqd7GYD+QRBB/2Q== dependencies: commander "^2.20.0" source-map "~0.6.1" @@ -12127,10 +12115,10 @@ webpack-bundle-analyzer@^3.5.2: opener "^1.5.1" ws "^6.0.0" -webpack-dev-middleware@^3.7.1: - version "3.7.1" - resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.7.1.tgz#1167aea02afa034489869b8368fe9fed1aea7d09" - integrity sha512-5MWu9SH1z3hY7oHOV6Kbkz5x7hXbxK56mGHNqHTe6d+ewxOwKUxoUJBs7QIaJb33lPjl9bJZ3X0vCoooUzC36A== +webpack-dev-middleware@^3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.7.2.tgz#0019c3db716e3fa5cecbf64f2ab88a74bab331f3" + integrity sha512-1xC42LxbYoqLNAhV6YzTYacicgMZQTqRd27Sim9wn5hJrX3I5nxYy1SxSd4+gjUFsz1dQFj+yEe6zEVmSkeJjw== dependencies: memory-fs "^0.4.1" mime "^2.4.4" From efd5a12ab00e978ac0259e6aae6dd1ab823aac72 Mon Sep 17 00:00:00 2001 From: Kevin Marrec Date: Mon, 30 Sep 2019 21:39:25 +0200 Subject: [PATCH 7/7] fix: tests --- jest.config.js | 3 +- .../typescript-runtime/test/hooks.test.js | 62 ------------------- 2 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 packages/typescript-runtime/test/hooks.test.js diff --git a/jest.config.js b/jest.config.js index e422b9dc..0dbc1904 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,8 +1,7 @@ module.exports = { testEnvironment: 'node', transform: { - '^.+\\.ts$': 'ts-jest', - '^.+\\.js$': 'babel-jest' + '^.+\\.ts$': 'ts-jest' }, globals: { 'ts-jest': { diff --git a/packages/typescript-runtime/test/hooks.test.js b/packages/typescript-runtime/test/hooks.test.js deleted file mode 100644 index c56c86e6..00000000 --- a/packages/typescript-runtime/test/hooks.test.js +++ /dev/null @@ -1,62 +0,0 @@ -import path from 'path' -import { register } from 'ts-node' -import { hooks } from '..' - -jest.mock('ts-node') - -describe('run:before hook', () => { - beforeEach(() => { - register.mockClear() - }) - - test('registers ts-node', () => { - hooks['run:before']({ argv: [], rootDir: 'path' }) - - expect(register).toHaveBeenCalledWith({ - project: path.resolve('path', 'tsconfig.json'), - compilerOptions: { - module: 'commonjs' - } - }) - }) - - test('registers ts-node (custom tsconfig.json path)', () => { - hooks['run:before']({ argv: ['--tsconfig', 'custom/tsconfig.json'], rootDir: 'path' }) - - expect(register).toHaveBeenCalledWith({ - project: path.resolve('custom/tsconfig.json'), - compilerOptions: { - module: 'commonjs' - } - }) - }) - - test('registers ts-node (custom tsconfig.json dir path)', () => { - hooks['run:before']({ argv: ['--tsconfig', 'custom'], rootDir: 'path' }) - - expect(register).toHaveBeenCalledWith({ - project: path.resolve('custom/tsconfig.json'), - compilerOptions: { - module: 'commonjs' - } - }) - }) -}) - -describe('config hook', () => { - test('adds ts extension (config.extensions is: defined)', () => { - const config = { extensions: [] } - - hooks.config(config) - - expect(config.extensions).toContain('ts') - }) - - test('adds ts extension (config.extensions is: undefined)', () => { - const config = {} - - hooks.config(config) - - expect(config.extensions).toContain('ts') - }) -})