diff --git a/.editorconfig b/.editorconfig index 391bcf3..d3b509d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,7 +11,7 @@ max_line_length = 80 indent_style = tab indent_size = 4 -[*.{md,yml}] +[*.{md,yaml}] indent_style = space [COMMIT_EDITMSG] diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..0d2b767 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,10 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily +- package-ecosystem: npm + directory: "/" + schedule: + interval: daily diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 5dd4d4b..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: 2 -updates: - # Maintain dependencies for GitHub Actions - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" - - # Maintain dependencies for npm - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "daily" diff --git a/.github/workflows/nodejs.yml b/.github/workflows/tests.yaml similarity index 67% rename from .github/workflows/nodejs.yml rename to .github/workflows/tests.yaml index 9b3d531..7ca2e20 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/tests.yaml @@ -7,11 +7,12 @@ jobs: strategy: matrix: node-version: - - 10.x - - 12.x + - 14.x + - 16.x + - 17.x steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v2.3.0 + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - run: npm install-test diff --git a/package.json b/package.json index aef758f..31c1816 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,10 @@ "node": ">=8" }, "dependencies": { - "@rollup/plugin-commonjs": "~16.0.0", - "@rollup/plugin-node-resolve": "~10.0.0", + "@rollup/plugin-commonjs": "~21.0.2", + "@rollup/plugin-node-resolve": "~11.2.1", "faucet-pipeline-core": "^1.4.0", - "rollup": "^2.33.3", + "rollup": "^2.68.0", "rollup-plugin-cleanup": "~3.2.1" }, "devDependencies": { @@ -38,8 +38,8 @@ "faucet-pipeline-jsmin": "file:pkg/faucet-pipeline-jsmin", "faucet-pipeline-jsx": "file:pkg/faucet-pipeline-jsx", "faucet-pipeline-typescript": "file:pkg/faucet-pipeline-typescript", - "json-diff": "^0.5.4", - "mocha": "^8.2.1", + "json-diff": "^0.7.1", + "mocha": "^9.2.1", "npm-run-all": "^4.1.5", "release-util-fnd": "^2.0.1" } diff --git a/pkg/faucet-pipeline-esnext/package.json b/pkg/faucet-pipeline-esnext/package.json index 1cebb45..bd06fa4 100644 --- a/pkg/faucet-pipeline-esnext/package.json +++ b/pkg/faucet-pipeline-esnext/package.json @@ -13,9 +13,9 @@ "url": "https://github.com/faucet-pipeline/faucet-pipeline-js/issues" }, "dependencies": { - "@babel/core": "~7.12.3", - "@babel/preset-env": "~7.12.1", - "@rollup/plugin-babel": "~5.2.1", + "@babel/core": "~7.17.5", + "@babel/preset-env": "~7.16.11", + "@rollup/plugin-babel": "~5.3.0", "faucet-pipeline-js": "2.1.7" } } diff --git a/pkg/faucet-pipeline-jsx/package.json b/pkg/faucet-pipeline-jsx/package.json index f318d5a..aa00b2d 100644 --- a/pkg/faucet-pipeline-jsx/package.json +++ b/pkg/faucet-pipeline-jsx/package.json @@ -13,7 +13,7 @@ "url": "https://github.com/faucet-pipeline/faucet-pipeline-js/issues" }, "dependencies": { - "@babel/plugin-transform-react-jsx": "~7.12.5", + "@babel/plugin-transform-react-jsx": "~7.17.3", "faucet-pipeline-esnext": "2.1.7" } } diff --git a/pkg/faucet-pipeline-typescript/package.json b/pkg/faucet-pipeline-typescript/package.json index d2d353c..c3fded3 100644 --- a/pkg/faucet-pipeline-typescript/package.json +++ b/pkg/faucet-pipeline-typescript/package.json @@ -16,8 +16,9 @@ "url": "https://github.com/faucet-pipeline/faucet-pipeline-js/issues" }, "dependencies": { - "@rollup/plugin-typescript": "~6.1.0", + "@rollup/plugin-typescript": "~8.3.0", "faucet-pipeline-js": "2.1.7", - "typescript": "~4.1.2" + "tslib": "~2.3.1", + "typescript": "~4.5.5" } } diff --git a/test/cli/run b/test/cli/run index 66cdeb7..2209597 100755 --- a/test/cli/run +++ b/test/cli/run @@ -25,7 +25,6 @@ end begin "$root/test_sourcemap" faucet --sourcemaps assert_identical_sourcemap "./dist/bundle.js" "./expected.js" "./expected.js.map" - assert_identical_sourcemap "./dist/bundle_esnext.js" "./expected_esnext.js" "./expected_esnext.js.map" end begin "$root/test_jsx" diff --git a/test/cli/test_browserslist/expected_legacy.js b/test/cli/test_browserslist/expected_legacy.js index 1fcf137..cbe1a8b 100644 --- a/test/cli/test_browserslist/expected_legacy.js +++ b/test/cli/test_browserslist/expected_legacy.js @@ -4,9 +4,28 @@ function _classCallCheck(instance, Constructor) { } } -var Util = function Util() { +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; +} + +var Util = /*#__PURE__*/_createClass(function Util() { _classCallCheck(this, Util); -}; +}); var FOO = "lorem ipsum"; var BAR = "dolor sit amet"; diff --git a/test/cli/test_bundle_customization/expected_iife.js b/test/cli/test_bundle_customization/expected_iife.js index 8e71d43..f4b8210 100644 --- a/test/cli/test_bundle_customization/expected_iife.js +++ b/test/cli/test_bundle_customization/expected_iife.js @@ -7,4 +7,4 @@ var index = _ => { return index; -}()); +})(); diff --git a/test/cli/test_bundle_customization/expected_umd.js b/test/cli/test_bundle_customization/expected_umd.js index c6f7ebe..8ffffa7 100644 --- a/test/cli/test_bundle_customization/expected_umd.js +++ b/test/cli/test_bundle_customization/expected_umd.js @@ -2,7 +2,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.MYLIB = factory()); -}(this, (function () { 'use strict'; +})(this, (function () { 'use strict'; var index = _ => { console.log("lipsum"); @@ -10,4 +10,4 @@ var index = _ => { return index; -}))); +})); diff --git a/test/cli/test_jsx/expected.js b/test/cli/test_jsx/expected.js index cd36eab..cd764a9 100644 --- a/test/cli/test_jsx/expected.js +++ b/test/cli/test_jsx/expected.js @@ -4,9 +4,28 @@ function _classCallCheck(instance, Constructor) { } } -var MyComponent = function MyComponent() { +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; +} + +var MyComponent = /*#__PURE__*/_createClass(function MyComponent() { _classCallCheck(this, MyComponent); -}; +}); var el = createElement(MyComponent, { type: "dummy" diff --git a/test/cli/test_manifest/expected.json b/test/cli/test_manifest/expected.json index cbf549a..a8b86da 100644 --- a/test/cli/test_manifest/expected.json +++ b/test/cli/test_manifest/expected.json @@ -1 +1 @@ -{"dist/bundle.js":"/assets/dist/bundle-6f9cdfdf5d45a70ad818b45090761ede.js"} +{"dist/bundle.js":"/assets/dist/bundle-7a1db6adc4ef815c9557d95c82779a74.js"} diff --git a/test/cli/test_manifest_uris/expected.json b/test/cli/test_manifest_uris/expected.json index 870488d..d35a706 100644 --- a/test/cli/test_manifest_uris/expected.json +++ b/test/cli/test_manifest_uris/expected.json @@ -1,4 +1,4 @@ { - "dist/foo.js":"/assets/foo-d252bfc59a9fd54bdd04535a90a0be25.js", - "dist/bar.js":"/assets/bar-913a3395880f817dd562e4adccf94168.js" + "dist/foo.js":"/assets/foo-71338920f697ae7208a107c326809bc1.js", + "dist/bar.js":"/assets/bar-0ddcb0327775137fe4fe372149de7e88.js" } diff --git a/test/cli/test_sourcemap/expected_esnext.js b/test/cli/test_sourcemap/expected_esnext.js deleted file mode 100644 index 2075893..0000000 --- a/test/cli/test_sourcemap/expected_esnext.js +++ /dev/null @@ -1,14 +0,0 @@ -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} - -var Util = function Util() { - _classCallCheck(this, Util); -}; -var FOO = "lorem ipsum"; -var BAR = "dolor sit amet"; - -console.log("~~ ".concat(Util, " ~~ ").concat(FOO, " ~~ ").concat(BAR, " ~~")); - diff --git a/test/cli/test_sourcemap/expected_esnext.js.map b/test/cli/test_sourcemap/expected_esnext.js.map deleted file mode 100644 index 9d77e9d..0000000 --- a/test/cli/test_sourcemap/expected_esnext.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sourcesContent":["export default class Util {}\n\nexport const FOO = \"lorem ipsum\";\nexport const BAR = \"dolor sit amet\";\n","import Util, { FOO, BAR } from \"./util\";\n\nconsole.log(`~~ ${Util} ~~ ${FOO} ~~ ${BAR} ~~`);\n"],"names":["Util","FOO","BAR","console","log"],"mappings":";;;;;;IAAqBA;;;AAEd,IAAMC,GAAG,GAAG,aAAZ;AACA,IAAMC,GAAG,GAAG,gBAAZ;;ACDPC,OAAO,CAACC,GAAR,cAAkBJ,IAAlB,iBAA6BC,GAA7B,iBAAuCC,GAAvC"} diff --git a/test/cli/test_sourcemap/faucet.config.js b/test/cli/test_sourcemap/faucet.config.js index 8f15cd9..b2737b2 100644 --- a/test/cli/test_sourcemap/faucet.config.js +++ b/test/cli/test_sourcemap/faucet.config.js @@ -7,11 +7,6 @@ module.exports = { source: "./src/index.js", target: "./dist/bundle.js", format: "esm" - }, { - source: "./src/index.js", - target: "./dist/bundle_esnext.js", - format: "esm", - esnext: true }], plugins: [path.resolve(__dirname, "../../..")] }; diff --git a/test/cli/test_transpilation/expected.js b/test/cli/test_transpilation/expected.js index 1fcf137..cbe1a8b 100644 --- a/test/cli/test_transpilation/expected.js +++ b/test/cli/test_transpilation/expected.js @@ -4,9 +4,28 @@ function _classCallCheck(instance, Constructor) { } } -var Util = function Util() { +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; +} + +var Util = /*#__PURE__*/_createClass(function Util() { _classCallCheck(this, Util); -}; +}); var FOO = "lorem ipsum"; var BAR = "dolor sit amet"; diff --git a/test/cli/test_typescript/expected.js b/test/cli/test_typescript/expected.js index 3ea8fe9..c5982bb 100644 --- a/test/cli/test_typescript/expected.js +++ b/test/cli/test_typescript/expected.js @@ -20,7 +20,7 @@ var generateArticle = function (params) { var title = params.title, authors = params.authors; if (typeof title !== "string") { log(LogLevel.Debug, "auto-generating title"); - title = title.main + ": " + title.sub; + title = "".concat(title.main, ": ").concat(title.sub); } return title + "\n" + authors.join(", "); }; @@ -32,4 +32,4 @@ generateArticle({ authors: ["foo", "bar"] }); -}()); +})(); diff --git a/test/unit/expected/virtual_bundle_js1.js b/test/unit/expected/virtual_bundle_js1.js index a5fd37d..6bc49dc 100644 --- a/test/unit/expected/virtual_bundle_js1.js +++ b/test/unit/expected/virtual_bundle_js1.js @@ -5,4 +5,4 @@ var UTIL = "UTIL"; console.log(UTIL); -}()); +})(); diff --git a/test/unit/expected/virtual_bundle_js2.js b/test/unit/expected/virtual_bundle_js2.js index b25552a..5edc95f 100644 --- a/test/unit/expected/virtual_bundle_js2.js +++ b/test/unit/expected/virtual_bundle_js2.js @@ -7,4 +7,4 @@ var MYLIB = "MY-LIB"; console.log(UTIL + MYLIB); -}()); +})(); diff --git a/test/unit/test_bundling.js b/test/unit/test_bundling.js index 1b6f359..31ae3ad 100644 --- a/test/unit/test_bundling.js +++ b/test/unit/test_bundling.js @@ -93,22 +93,11 @@ console.log("[\\u2026] ".concat(util)); // eslint-disable-line no-console filepath: path.resolve(FIXTURES_DIR, "./dist/bundle.js"), /* eslint-disable max-len */ content: makeBundle(` -function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function (path, base) { - return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); - } - }, fn(module, module.exports), module.exports; -} - -function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); -} +var dist = {exports: {}}; -var dist = createCommonjsModule(function (module) { /* eslint-disable */ + +(function (module) { (function(window) { var MYLIB = "MY-LIB"; @@ -118,9 +107,11 @@ var MYLIB = "MY-LIB"; } }()); -}); +}(dist)); + +var MYLIB = dist.exports; -console.log("[\\u2026] ".concat(dist)); // eslint-disable-line no-console +console.log("[\\u2026] ".concat(MYLIB)); // eslint-disable-line no-console `.trim()) /* eslint-enable max-len */ }]); @@ -186,7 +177,7 @@ return lib; assetManager.assertWrites([{ filepath: path.resolve(FIXTURES_DIR, "./dist/bundle.js"), content: ` -define(function () { 'use strict'; +define((function () { 'use strict'; var util = "UTIL"; @@ -196,7 +187,7 @@ var lib = msg => { return lib; -}); +})); `.trim() + "\n" }]); }); @@ -242,9 +233,9 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau var MYLIB__default = /*#__PURE__*/_interopDefaultLegacy(MYLIB); -console.log(\`[…] $\{MYLIB__default['default']}\`); // eslint-disable-line no-console +console.log(\`[…] $\{MYLIB__default["default"]}\`); // eslint-disable-line no-console -}(MYLIB)); +})(MYLIB); `.trim() + "\n" }]); }); diff --git a/test/unit/util.js b/test/unit/util.js index 52133bd..833a91f 100644 --- a/test/unit/util.js +++ b/test/unit/util.js @@ -40,7 +40,7 @@ exports.MockAssetManager = class MockAssetManager extends AssetManager { exports.makeBundle = function makeBundle(code, { compact } = {}) { if(compact) { return ` -(function(){'use strict';${code}}()); +(function(){'use strict';${code}})(); `.trim(); } @@ -50,7 +50,7 @@ exports.makeBundle = function makeBundle(code, { compact } = {}) { ${code} -}()); +})(); `.trim() + "\n"; };