This is an automated email from the ASF dual-hosted git repository. randall pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git
commit c913f53431db23869292175fb321aa80077fb6b2 Author: Randall Leeds <[email protected]> AuthorDate: Sun Apr 11 15:23:19 2021 -0700 Remove CommonJS build Supporting two builds has been complicated and increasingly unnecessary. Expect consumers to be using bundlers or versions of Node.js that have support for ECMAScript Modules. --- babel.config.js | 7 +++---- package.json | 10 ++++------ packages/apache-annotator/package.json | 6 ++---- packages/dom/package.json | 7 ++----- packages/selector/package.json | 7 ++----- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/babel.config.js b/babel.config.js index 9251327..6eeba3a 100644 --- a/babel.config.js +++ b/babel.config.js @@ -25,7 +25,6 @@ module.exports = (api) => { const ENV = api.env(); const DEV = ENV === 'development'; const TEST = ENV === 'test'; - const CJS = ENV === 'cjs'; // Options for the @babel/env preset. const envOptions = { @@ -33,7 +32,7 @@ module.exports = (api) => { // Note: This setting may become the default in Babel 8. bugfixes: true, // Transform module syntax if necessary. - modules: CJS || TEST ? 'commonjs' : false, + modules: TEST ? 'commonjs' : false, }; // Options for the @babel/typescript preset. @@ -45,7 +44,7 @@ module.exports = (api) => { }; const addImportExtensionOptions = { - extension: DEV || TEST ? 'ts' : CJS ? 'js' : 'mjs', + extension: DEV || TEST ? 'ts' : 'js', }; // Options for the module-resolver plugin. @@ -67,7 +66,7 @@ module.exports = (api) => { // Use corejs version 3. corejs: { version: 3, proposals: true }, // Use helpers formatted for the target environment. - useESModules: !CJS && !TEST, + useESModules: !TEST, }; return { diff --git a/package.json b/package.json index 1552487..e4d0dc5 100644 --- a/package.json +++ b/package.json @@ -15,16 +15,14 @@ ] }, "scripts": { - "build": "concurrently yarn:build:lib:* yarn:build:misc", - "build:lib": "lerna exec --parallel -- babel -d lib -s inline -x .ts --root-mode upward src", - "build:lib:cjs": "cross-env BABEL_ENV=cjs yarn build:lib", - "build:lib:esm": "cross-env BABEL_ENV=esm yarn build:lib --out-file-extension .mjs", - "build:lib:types": "tsc --build", + "build": "concurrently yarn:build:*", + "build:js": "lerna exec --parallel -- babel -d lib -s inline -x .ts --env-name production --root-mode upward src", "build:misc": "lerna exec --parallel -- cp ../../DISCLAIMER-WIP ../../LICENSE ../../NOTICE ../../README.md .", + "build:types": "tsc --build", "clean": "tsc --build --clean && lerna exec -- rimraf DISCLAIMER-WIP LICENSE NOTICE README.md lib && rimraf docs", "docs": "tsc --build && typedoc", "lint": "tsc --build && eslint .", - "prepare": "yarn run build:lib:types && lerna run prepare", + "prepare": "yarn run build:types && lerna run prepare", "prepublishOnly": "yarn run build", "publish": "lerna publish", "publish:ci": "yarn run publish --canary --exact --force-publish '*' --no-verify-access --yes minor", diff --git a/packages/apache-annotator/package.json b/packages/apache-annotator/package.json index 00a6159..e144574 100644 --- a/packages/apache-annotator/package.json +++ b/packages/apache-annotator/package.json @@ -10,11 +10,9 @@ }, "license": "Apache-2.0", "author": "Apache Software Foundation", + "type": "module", "exports": { - "./*": { - "import": "./lib/*.mjs", - "require": "./lib/*.js" - } + "./*": "./lib/*.js" }, "dependencies": { "@apache-annotator/dom": "^0.1.0", diff --git a/packages/dom/package.json b/packages/dom/package.json index 64ea454..ff22835 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -10,12 +10,9 @@ }, "license": "Apache-2.0", "author": "Apache Software Foundation", - "exports": { - "import": "./lib/index.mjs", - "require": "./lib/index.js" - }, + "type": "module", + "exports": "./lib/index.js", "main": "./lib/index.js", - "module": "./lib/index.mjs", "dependencies": { "@babel/runtime-corejs3": "^7.13.10" }, diff --git a/packages/selector/package.json b/packages/selector/package.json index c92ccbf..0691e8e 100644 --- a/packages/selector/package.json +++ b/packages/selector/package.json @@ -10,12 +10,9 @@ }, "license": "Apache-2.0", "author": "Apache Software Foundation", - "exports": { - "import": "./lib/index.mjs", - "require": "./lib/index.js" - }, + "type": "module", + "exports": "./lib/index.js", "main": "./lib/index.js", - "module": "./lib/index.mjs", "dependencies": { "@babel/runtime-corejs3": "^7.13.10" },
