diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..349a9c55 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,28 @@ +version: 2 +jobs: + build: + docker: + # https://circleci.com/docs/2.0/circleci-images/#nodejs + - image: circleci/node:6 + + working_directory: ~/vue-style-loader + + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: yarn install + + - save_cache: + paths: + - node_modules + key: v1-dependencies-{{ checksum "package.json" }} + + # run tests! + - run: yarn test diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..6e5a7f87 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,68 @@ + +## [4.1.2](https://github.com/vuejs/vue-style-loader/compare/v4.1.1...v4.1.2) (2018-08-13) + + +### Bug Fixes + +* fix inconsistent hashes between Windows and POSIX systems ([#28](https://github.com/vuejs/vue-style-loader/issues/28)) ([cf8b6e8](https://github.com/vuejs/vue-style-loader/commit/cf8b6e8)) + + + + +## [4.1.1](https://github.com/vuejs/vue-style-loader/compare/v4.1.0...v4.1.1) (2018-07-17) + + +### Bug Fixes + +* fix addStyleShadow when same style object is inserted multiple times ([12846a6](https://github.com/vuejs/vue-style-loader/commit/12846a6)) + + + + +# [4.1.0](https://github.com/vuejs/vue-style-loader/compare/v4.0.2...v4.1.0) (2018-03-20) + + +### Features + +* support vue-loader 15 ([0c7ee9d](https://github.com/vuejs/vue-style-loader/commit/0c7ee9d)) + + + + +## [4.0.2](https://github.com/vuejs/vue-style-loader/compare/v4.0.1...v4.0.2) (2018-02-13) + + + + +## [4.0.1](https://github.com/vuejs/vue-style-loader/compare/v4.0.0...v4.0.1) (2018-01-31) + + +### Bug Fixes + +* typo ([00087b7](https://github.com/vuejs/vue-style-loader/commit/00087b7)) + + + + +# [4.0.0](https://github.com/vuejs/vue-style-loader/compare/v3.1.1...v4.0.0) (2018-01-31) + + +### Features + +* shadowMode ([94737e5](https://github.com/vuejs/vue-style-loader/commit/94737e5)) +* use ESM for runtime files ([18d0ae4](https://github.com/vuejs/vue-style-loader/commit/18d0ae4)) + + + + +## [3.1.1](https://github.com/vuejs/vue-style-loader/compare/v3.1.0...v3.1.1) (2018-01-24) + + + + +# [3.1.0](https://github.com/vuejs/vue-style-loader/compare/v3.0.3...v3.1.0) (2018-01-24) + + +### Features + +* add `ssrId` option for rendering ssr id on client ([5281305](https://github.com/vuejs/vue-style-loader/commit/5281305)) diff --git a/index.js b/index.js index 0bcb0f55..570ef3d2 100644 --- a/index.js +++ b/index.js @@ -6,12 +6,11 @@ var loaderUtils = require('loader-utils') var path = require('path') var hash = require('hash-sum') +var qs = require('querystring') module.exports = function () {} module.exports.pitch = function (remainingRequest) { - if (this.cacheable) this.cacheable() - var isServer = this.target === 'node' var isProduction = this.minimize || process.env.NODE_ENV === 'production' var addStylesClientPath = loaderUtils.stringifyRequest(this, '!' + path.join(__dirname, 'lib/addStylesClient.js')) @@ -19,19 +18,26 @@ module.exports.pitch = function (remainingRequest) { var addStylesShadowPath = loaderUtils.stringifyRequest(this, '!' + path.join(__dirname, 'lib/addStylesShadow.js')) var request = loaderUtils.stringifyRequest(this, '!!' + remainingRequest) - var id = JSON.stringify(hash(request + path.relative(__dirname, this.resourcePath))) + var relPath = path.relative(__dirname, this.resourcePath).replace(/\\/g, '/') + var id = JSON.stringify(hash(request + relPath)) var options = loaderUtils.getOptions(this) || {} // direct css import from js --> direct, or manually call `styles.__inject__(ssrContext)` with `manualInject` option // css import from vue file --> component lifecycle linked // style embedded in vue file --> component lifecycle linked - var isVue = /"vue":true/.test(remainingRequest) || options.manualInject + var isVue = ( + /"vue":true/.test(remainingRequest) || + options.manualInject || + qs.parse(this.resourceQuery.slice(1)).vue != null + ) var shared = [ '// style-loader: Adds some css to the DOM by adding a