From: Eduardo San Martin Morote Date: Mon, 6 May 2019 13:57:48 +0000 (+0200) Subject: build: refactor to build esm version X-Git-Tag: v4.0.0-alpha.0~391 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7c889b91d8d37c44e852c2c04c175a04b7df9565;p=thirdparty%2Fvuejs%2Frouter.git build: refactor to build esm version --- diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json new file mode 100644 index 00000000..59ce0205 --- /dev/null +++ b/__tests__/tsconfig.json @@ -0,0 +1,8 @@ +{ + "include": ["./**/*.ts"], + "compilerOptions": { + "target": "esnext", + "module": "commonjs", + "allowJs": true + } +} diff --git a/explorations/tsconfig.json b/explorations/tsconfig.json new file mode 100644 index 00000000..fa8b346e --- /dev/null +++ b/explorations/tsconfig.json @@ -0,0 +1,20 @@ +{ + "include": ["./**/*.ts"], + "compilerOptions": { + "target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, + "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, + // "lib": ["es2017.object"] /* Specify library files to be included in the compilation. */, + // "declaration": true /* Generates corresponding '.d.ts' file. */, + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + "sourceMap": true /* Generates corresponding '.map' file. */, + // "outFile": "./", /* Concatenate and emit output to single file. */ + "outDir": "./dist" /* Redirect output structure to the directory. */, + + "strict": true /* Enable all strict type-checking options. */, + "noUnusedLocals": true /* Report errors on unused locals. */, + "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, + + "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + } +} diff --git a/package.json b/package.json index 7d7abb8e..9b5015e7 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,12 @@ "test:mocha": "NODE_ENV=test mocha -r ts-node/register __tests__/**/*.spec.js __tests__/*.spec.js", "test:mocha:dev": "yarn run test:mocha -w --extension ts --reporter min", "test": "yarn run test:unit", + "build:esm": "yarn tsc -d -t ESNEXT -m ESNext", "dev": "webpack-dev-server --mode=development" }, "devDependencies": { "@types/jest": "^24.0.11", "@types/jsdom": "^12.2.3", - "@types/mocha": "^5.2.6", "consola": "^2.5.8", "expect": "^24.7.1", "faked-promise": "^2.1.0", diff --git a/tsconfig.json b/tsconfig.json index 6331e3a7..1f7761af 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "include": ["src/**/*.ts", "explorations/**/*.ts"], + "include": ["src/**/*.ts"], "compilerOptions": { /* Basic Options */ "target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, @@ -8,7 +8,7 @@ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ + "declaration": true /* Generates corresponding '.d.ts' file. */, // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ "sourceMap": true /* Generates corresponding '.map' file. */, // "outFile": "./", /* Concatenate and emit output to single file. */ diff --git a/yarn.lock b/yarn.lock index 6a673eb4..1698ab1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -342,11 +342,6 @@ "@types/tough-cookie" "*" parse5 "^4.0.0" -"@types/mocha@^5.2.6": - version "5.2.6" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.6.tgz#b8622d50557dd155e9f2f634b7d68fd38de5e94b" - integrity sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw== - "@types/node@*": version "11.13.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.0.tgz#b0df8d6ef9b5001b2be3a94d909ce3c29a80f9e1"