diff --git a/.babelrc b/.babelrc index 69085dd3..a63facd3 100644 --- a/.babelrc +++ b/.babelrc @@ -5,7 +5,7 @@ { "useBuiltIns": true, "targets": { - "node": "4.8" + "node": "6.9.0" }, "exclude": [ "transform-async-to-generator", diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..34a0e515 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,161 @@ +unit_tests: &unit_tests + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: NPM Rebuild + command: npm install + - run: + name: Run unit tests. + command: npm run ci:test +# canary_tests: &canary_tests +# steps: +# - checkout +# - setup_remote_docker +# - restore_cache: +# key: dependency-cache-{{ checksum "package-lock.json" }} +# - run: +# name: NPM Rebuild +# command: npm install +# - run: +# name: Install Webpack Canary +# command: npm i --no-save webpack@next +# - run: +# name: Run unit tests. +# command: npm run ci:test + +version: 2 +jobs: + dependency_cache: + docker: + - image: webpackcontrib/circleci-node-base:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: Install Dependencies + command: npm install + - save_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + paths: + - ./node_modules + + node8-latest: + docker: + - image: webpackcontrib/circleci-node8:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: NPM Rebuild + command: npm install + - run: + name: Run unit tests. + command: npm run ci:coverage + - run: + name: Submit coverage data to codecov. + command: bash <(curl -s https://codecov.io/bash) + when: on_success + node6-latest: + docker: + - image: webpackcontrib/circleci-node6:latest + <<: *unit_tests + node9-latest: + docker: + - image: webpackcontrib/circleci-node9:latest + <<: *unit_tests + # node8-canary: + # docker: + # - image: webpackcontrib/circleci-node8:latest + # <<: *canary_tests + analysis: + docker: + - image: webpackcontrib/circleci-node-base:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: NPM Rebuild + command: npm install + - run: + name: Run linting. + command: npm run lint + - run: + name: Run NSP Security Check. + command: npm run security + # - run: + # name: Validate Commit Messages + # command: npm run ci:lint:commits + publish: + docker: + - image: webpackcontrib/circleci-node-base:latest + steps: + - checkout + - setup_remote_docker + - restore_cache: + key: dependency-cache-{{ checksum "package-lock.json" }} + - run: + name: NPM Rebuild + command: npm install + - run: + name: Validate Commit Messages + command: npm run release:validate + - run: + name: Publish to NPM + command: printf "noop running conventional-github-releaser" + +version: 2.0 +workflows: + version: 2 + validate-publish: + jobs: + - dependency_cache + - node6-latest: + requires: + - dependency_cache + filters: + tags: + only: /.*/ + - analysis: + requires: + - dependency_cache + filters: + tags: + only: /.*/ + - node8-latest: + requires: + - analysis + - node6-latest + filters: + tags: + only: /.*/ + - node9-latest: + requires: + - analysis + - node6-latest + filters: + tags: + only: /.*/ + # - node8-canary: + # requires: + # - analysis + # - node6-latest + filters: + tags: + only: /.*/ + - publish: + requires: + - node8-latest + - node9-latest + filters: + branches: + only: + - master diff --git a/.jestrc b/.jestrc new file mode 100644 index 00000000..5f22ee69 --- /dev/null +++ b/.jestrc @@ -0,0 +1,3 @@ +{ + "testEnvironment": "node" +} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 16f2daba..00000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -sudo: false -dist: trusty -language: node_js -branches: - only: - - master -jobs: - fast_finish: true - allow_failures: - - env: WEBPACK_VERSION=canary - include: - - &test-latest - stage: Webpack latest - node_js: 6 - env: WEBPACK_VERSION=latest JOB_PART=test - script: npm run travis:$JOB_PART - - <<: *test-latest - node_js: 4.8 - env: WEBPACK_VERSION=latest JOB_PART=test - script: npm run travis:$JOB_PART - - <<: *test-latest - node_js: 8 - env: WEBPACK_VERSION=latest JOB_PART=lint - script: npm run travis:$JOB_PART - - <<: *test-latest - node_js: 8 - env: WEBPACK_VERSION=latest JOB_PART=coverage - script: npm run travis:$JOB_PART - after_success: 'bash <(curl -s https://codecov.io/bash)' - - stage: Webpack canary - before_script: npm i --no-save git://github.com/webpack/webpack.git#master - script: npm run travis:$JOB_PART - node_js: 8 - env: WEBPACK_VERSION=canary JOB_PART=test -before_install: - - 'if [[ `npm -v` != 5* ]]; then npm i -g npm@^5.0.0; fi' - - nvm --version - - node --version - - npm --version -before_script: - - |- - if [ "$WEBPACK_VERSION" ]; then - npm i --no-save webpack@$WEBPACK_VERSION - fi -script: - - 'npm run travis:$JOB_PART' -after_success: - - 'bash <(curl -s https://codecov.io/bash)' diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 031df576..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,29 +0,0 @@ -branches: - only: - - master -init: - - git config --global core.autocrlf input -environment: - matrix: - - nodejs_version: '8' - webpack_version: latest - job_part: test - - nodejs_version: '6' - webpack_version: latest - job_part: test - - nodejs_version: '4.8' - webpack_version: latest - job_part: test -build: 'off' -matrix: - fast_finish: true -install: - - ps: Install-Product node $env:nodejs_version x64 - - npm i -g npm@latest - - npm install -before_test: - - cmd: npm install webpack@%webpack_version% -test_script: - - node --version - - npm --version - - cmd: npm run appveyor:%job_part% diff --git a/package-lock.json b/package-lock.json index 0c515e91..56534e73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -81,6 +81,7 @@ "version": "5.2.3", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.3.tgz", "integrity": "sha1-wG9Zh3jETGsWGrr+NGa4GtGBTtI=", + "dev": true, "requires": { "co": "4.6.0", "fast-deep-equal": "1.0.0", @@ -1516,7 +1517,8 @@ "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true }, "code-point-at": { "version": "1.1.0", @@ -2771,6 +2773,11 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", @@ -5461,6 +5468,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, "requires": { "jsonify": "0.0.0" } @@ -5479,7 +5487,8 @@ "jsonify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true }, "jsonparse": { "version": "1.3.1", @@ -7616,11 +7625,30 @@ "dev": true }, "schema-utils": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.3.0.tgz", - "integrity": "sha1-9YdyIs4+kx7a4DnxfrNxbnE3+M8=", + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", + "integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", "requires": { - "ajv": "5.2.3" + "ajv": "6.4.0", + "ajv-keywords": "3.1.0" + }, + "dependencies": { + "ajv": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.4.0.tgz", + "integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=", + "requires": { + "fast-deep-equal": "1.0.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1", + "uri-js": "3.0.2" + } + }, + "ajv-keywords": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.1.0.tgz", + "integrity": "sha1-rCsnk5xUPpXSwG5/f1wnvkqlQ74=" + } } }, "semver": { @@ -8465,6 +8493,21 @@ } } }, + "uri-js": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-3.0.2.tgz", + "integrity": "sha1-+QuFhQf4HepNz7s8TD2/orVX+qo=", + "requires": { + "punycode": "2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", + "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=" + } + } + }, "url": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", diff --git a/package.json b/package.json index 7065aae3..7c4f72ca 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,14 @@ "version": "1.1.1", "author": "Tobias Koppers @sokra", "description": "worker loader module for webpack", + "repository": "https://github.com/webpack-contrib/worker-loader.git", + "bugs": "https://github.com/webpack-contrib/worker-loader/issues", + "homepage": "https://github.com/webpack-contrib/worker-loader", + "license": "MIT", "main": "dist/cjs.js", "files": [ "dist" ], - "engines": { - "node": ">= 4.8 < 5.0.0 || >= 5.10" - }, "scripts": { "start": "npm run build -- -w", "build": "cross-env NODE_ENV=production babel src -d dist --ignore 'src/**/*.test.js' --copy-files", @@ -23,15 +24,11 @@ "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --collectCoverageFrom='src/**/*.js' --coverage", - "travis:lint": "npm run lint && npm run security", - "travis:test": "npm run test -- --runInBand", - "travis:coverage": "npm run test:coverage -- --runInBand", - "appveyor:test": "npm run test", + "ci:lint": "npm run lint && npm run security", + "ci:test": "npm run test -- --runInBand", + "ci:coverage": "npm run test:coverage -- --runInBand", "defaults": "webpack-defaults" }, - "peerDependencies": { - "webpack": "^2.0.0 || ^3.0.0 || ^4.0.0" - }, "dependencies": { "loader-utils": "^1.0.0", "schema-utils": "^0.4.0" @@ -56,10 +53,12 @@ "webpack": "^3.0.0", "webpack-defaults": "^1.6.0" }, - "repository": "https://github.com/webpack-contrib/worker-loader.git", - "bugs": "https://github.com/webpack-contrib/worker-loader/issues", - "homepage": "https://github.com/webpack-contrib/worker-loader", - "license": "MIT", + "peerDependencies": { + "webpack": "^3.0.0 || ^4.0.0-alpha.0 || ^4.0.0" + }, + "engines": { + "node": ">= 6.9.0 || >= 8.9.0" + }, "pre-commit": "lint-staged", "lint-staged": { "*.js": [ diff --git a/test/__snapshots__/Errors.test.js.snap b/test/__snapshots__/Errors.test.js.snap index 998d6d1c..348886e3 100644 --- a/test/__snapshots__/Errors.test.js.snap +++ b/test/__snapshots__/Errors.test.js.snap @@ -8,9 +8,7 @@ This loader is only usable with webpack `; exports[`Errors Validation Error 1`] = ` -"Validation Error - -Worker Loader Invalid Options +"Worker Loader Invalid Options options.name should be string "