diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-06-13 01:43:37 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-06-13 01:43:37 +0200 |
commit | 03322672782a6318b019eff33fe44ec800d6f12c (patch) | |
tree | 9d807e1585cf28a1ea98e87b855932dba00f1880 /.config | |
parent | 8e18b4698edd00f83af0be05bb3374f92fecaeb9 (diff) | |
download | svg.js-03322672782a6318b019eff33fe44ec800d6f12c.tar.gz svg.js-03322672782a6318b019eff33fe44ec800d6f12c.zip |
dependency updates, easier formatting
Diffstat (limited to '.config')
-rw-r--r-- | .config/karma.conf.cjs (renamed from .config/karma.conf.js) | 4 | ||||
-rw-r--r-- | .config/karma.conf.common.cjs (renamed from .config/karma.conf.common.js) | 0 | ||||
-rw-r--r-- | .config/karma.conf.saucelabs.cjs (renamed from .config/karma.conf.saucelabs.js) | 17 | ||||
-rw-r--r-- | .config/polyfillListIE.js | 4 | ||||
-rw-r--r-- | .config/pretest.js | 8 | ||||
-rw-r--r-- | .config/rollup.config.js | 81 | ||||
-rw-r--r-- | .config/rollup.tests.js | 64 |
7 files changed, 101 insertions, 77 deletions
diff --git a/.config/karma.conf.js b/.config/karma.conf.cjs index 67667c7..7584c92 100644 --- a/.config/karma.conf.js +++ b/.config/karma.conf.cjs @@ -1,5 +1,5 @@ // Karma configuration -const karmaCommon = require('./karma.conf.common.js') +const karmaCommon = require('./karma.conf.common.cjs') let chromeBin = 'ChromeHeadless' if (process.platform === 'linux') { @@ -75,7 +75,7 @@ module.exports = function (config) { }, instrumenterOptions: { istanbul: { - esModules: true + esModules: true } } }, diff --git a/.config/karma.conf.common.js b/.config/karma.conf.common.cjs index 4808996..4808996 100644 --- a/.config/karma.conf.common.js +++ b/.config/karma.conf.common.cjs diff --git a/.config/karma.conf.saucelabs.js b/.config/karma.conf.saucelabs.cjs index 089f25a..484ebee 100644 --- a/.config/karma.conf.saucelabs.js +++ b/.config/karma.conf.saucelabs.cjs @@ -2,9 +2,9 @@ // https://wiki.saucelabs.com/display/DOCS/Platform+Configurator // TODO: remove dotenv after local test -require('dotenv').config() +// require('dotenv').config() -const karmaCommon = require('./karma.conf.common.js') +const karmaCommon = require('./karma.conf.common.cjs') const SauceLabsLaunchers = { /** Real mobile devices are not available @@ -39,7 +39,7 @@ const SauceLabsLaunchers = { base: 'SauceLabs', browserName: 'internet explorer', version: '11.0' - }/* + } /* sl_windows_edge: { base: 'SauceLabs', browserName: 'MicrosoftEdge', @@ -54,7 +54,7 @@ const SauceLabsLaunchers = { recordVideo: true, recordScreenshots: true, screenResolution: '1024x768' - } *//*, + } */ /*, sl_macos_iphone: { base: 'SauceLabs', browserName: 'Safari', @@ -85,7 +85,9 @@ const SauceLabsLaunchers = { module.exports = function (config) { if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) { - console.error('SAUCE_USERNAME and SAUCE_ACCESS_KEY must be provided as environment variables.') + console.error( + 'SAUCE_USERNAME and SAUCE_ACCESS_KEY must be provided as environment variables.' + ) console.warn('Aborting Sauce Labs test') process.exit(1) } @@ -100,10 +102,7 @@ module.exports = function (config) { // so if you are really puzzled why something isn't working, then comment // out plugins: [] - it's here to make karma load faster // get possible karma plugins by `ls node_modules | grep 'karma-*'` - plugins: [ - 'karma-jasmine', - 'karma-sauce-launcher' - ], + plugins: ['karma-jasmine', 'karma-sauce-launcher'], // logLevel: config.LOG_DEBUG, diff --git a/.config/polyfillListIE.js b/.config/polyfillListIE.js index dbffbc5..7c7fc33 100644 --- a/.config/polyfillListIE.js +++ b/.config/polyfillListIE.js @@ -14,7 +14,9 @@ CustomEventPolyfill() try { if (!SVGElement.prototype.children) { Object.defineProperty(SVGElement.prototype, 'children', { - get: function () { return children(this) } + get: function () { + return children(this) + } }) } } catch (e) {} diff --git a/.config/pretest.js b/.config/pretest.js index 23b989e..0e6ecb7 100644 --- a/.config/pretest.js +++ b/.config/pretest.js @@ -1,15 +1,17 @@ /* global XMLHttpRequest */ 'use strict' -function get (uri) { +function get(uri) { var xhr = new XMLHttpRequest() xhr.open('GET', uri, false) xhr.send() - if (xhr.status !== 200) { console.error('SVG.js fixture could not be loaded. Tests will fail.') } + if (xhr.status !== 200) { + console.error('SVG.js fixture could not be loaded. Tests will fail.') + } return xhr.responseText } -function main () { +function main() { var style = document.createElement('style') document.head.appendChild(style) style.sheet.insertRule(get('/fixtures/fixture.css'), 0) diff --git a/.config/rollup.config.js b/.config/rollup.config.js index 8391ba0..586e8ea 100644 --- a/.config/rollup.config.js +++ b/.config/rollup.config.js @@ -1,9 +1,9 @@ -import * as pkg from '../package.json' +import pkg from '../package.json' assert { type: 'json' } import babel from '@rollup/plugin-babel' import resolve from '@rollup/plugin-node-resolve' import commonjs from '@rollup/plugin-commonjs' import filesize from 'rollup-plugin-filesize' -import { terser } from 'rollup-plugin-terser' +import terser from '@rollup/plugin-terser' const buildDate = Date() @@ -21,17 +21,22 @@ const headerLong = `/*! const headerShort = `/*! ${pkg.name} v${pkg.version} ${pkg.license}*/;` const getBabelConfig = (node = false) => { - let targets = pkg.browserslist const plugins = [ - ['@babel/transform-runtime', { - version: "^7.14.5", - regenerator: false, - useESModules: true - }], - ["polyfill-corejs3", { - "method": "usage-pure" - }] + [ + '@babel/transform-runtime', + { + version: '^7.14.5', + regenerator: false, + useESModules: true + } + ], + [ + 'polyfill-corejs3', + { + method: 'usage-pure' + } + ] ] if (node) { @@ -43,15 +48,20 @@ const getBabelConfig = (node = false) => { babelHelpers: 'runtime', babelrc: false, targets: targets, - presets: [['@babel/preset-env', { - modules: false, - // useBuildins and plugin-transform-runtime are mutually exclusive - // https://github.com/babel/babel/issues/10271#issuecomment-528379505 - // use babel-polyfills when released - useBuiltIns: false, - bugfixes: true, - loose: true - }]], + presets: [ + [ + '@babel/preset-env', + { + modules: false, + // useBuildins and plugin-transform-runtime are mutually exclusive + // https://github.com/babel/babel/issues/10271#issuecomment-528379505 + // use babel-polyfills when released + useBuiltIns: false, + bugfixes: true, + loose: true + } + ] + ], plugins }) } @@ -90,11 +100,14 @@ const classes = [ ] const config = (node, min, esm = false) => ({ - input: (node || esm) ? './src/main.js' : './src/svg.js', + input: node || esm ? './src/main.js' : './src/svg.js', output: { - file: esm ? './dist/svg.esm.js' - : node ? './dist/svg.node.js' - : min ? './dist/svg.min.js' + file: esm + ? './dist/svg.esm.js' + : node + ? './dist/svg.node.js' + : min + ? './dist/svg.min.js' : './dist/svg.js', format: esm ? 'esm' : node ? 'cjs' : 'iife', name: 'SVG', @@ -112,18 +125,20 @@ const config = (node, min, esm = false) => ({ commonjs(), getBabelConfig(node), filesize(), - !min ? {} : terser({ - mangle: { - reserved: classes - }, - output: { - preamble: headerShort - } - }) + !min + ? {} + : terser({ + mangle: { + reserved: classes + }, + output: { + preamble: headerShort + } + }) ] }) // [node, minified, esm] const modes = [[false], [false, true], [true], [false, false, true]] -export default modes.map(m => config(...m)) +export default modes.map((m) => config(...m)) diff --git a/.config/rollup.tests.js b/.config/rollup.tests.js index 3620149..fe093b6 100644 --- a/.config/rollup.tests.js +++ b/.config/rollup.tests.js @@ -4,40 +4,46 @@ import multiEntry from '@rollup/plugin-multi-entry' import resolve from '@rollup/plugin-node-resolve' import commonjs from '@rollup/plugin-commonjs' -const getBabelConfig = (targets) => babel({ - include: ['src/**', 'spec/**/*'], - babelHelpers: 'runtime', - babelrc: false, - presets: [['@babel/preset-env', { - modules: false, - targets: targets || pkg.browserslist, - // useBuildins and plugin-transform-runtime are mutually exclusive - // https://github.com/babel/babel/issues/10271#issuecomment-528379505 - // use babel-polyfills when released - useBuiltIns: false, - // corejs: 3, - bugfixes: true - }]], - plugins: [ - ['@babel/plugin-transform-runtime', { - corejs: 3, - helpers: true, - useESModules: true, - version: "^7.9.6", - regenerator: false - }] - ] -}) +const getBabelConfig = (targets) => + babel({ + include: ['src/**', 'spec/**/*'], + babelHelpers: 'runtime', + babelrc: false, + presets: [ + [ + '@babel/preset-env', + { + modules: false, + targets: targets || pkg.browserslist, + // useBuildins and plugin-transform-runtime are mutually exclusive + // https://github.com/babel/babel/issues/10271#issuecomment-528379505 + // use babel-polyfills when released + useBuiltIns: false, + // corejs: 3, + bugfixes: true + } + ] + ], + plugins: [ + [ + '@babel/plugin-transform-runtime', + { + corejs: 3, + helpers: true, + useESModules: true, + version: '^7.9.6', + regenerator: false + } + ] + ] + }) export default { - input: [ - 'spec/setupBrowser.js', - 'spec/spec/*/*.js' - ], + input: ['spec/setupBrowser.js', 'spec/spec/*/*.js'], output: { file: 'spec/es5TestBundle.js', name: 'SVGTests', - format: 'iife', + format: 'iife' }, plugins: [ resolve({ browser: true }), |