rollup-plugin-lib-style 1.2.3 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.es.js CHANGED
@@ -52,13 +52,13 @@ const postCssLoader = async ({code, fiePath, options}) => {
52
52
  const dependencies = [];
53
53
  for (const message of result.messages) {
54
54
  if (message.type === "dependency") {
55
- dependencies.add(message.file);
55
+ dependencies.push(message.file);
56
56
  }
57
57
  }
58
58
 
59
59
  // print postcss warnings
60
60
  for (const warning of result.warnings()) {
61
- console.warn(warning.message || warning.text);
61
+ console.warn(`WARNING: ${warning.plugin}:`, warning.text);
62
62
  }
63
63
 
64
64
  return {
@@ -118,7 +118,7 @@ const libStylePlugin = (options = {}) => {
118
118
 
119
119
  const postCssResult = await postCssLoader({code: rawCss.code, fiePath: id, options: postCssOptions});
120
120
 
121
- for (const dependence of postCssResult.dependencies) this.addWatchFile(dependence);
121
+ for (const dependency of postCssResult.dependencies) this.addWatchFile(dependency);
122
122
 
123
123
  const cssFilePath = id.replace(process.cwd(), "").replace(/\\/g, "/");
124
124
 
package/lib/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var rollupPluginutils = require('rollup-pluginutils');
6
4
  var postcss = require('postcss');
7
5
  var postcssModules = require('postcss-modules');
@@ -9,14 +7,6 @@ var fs = require('fs-extra');
9
7
  var sass = require('sass');
10
8
  var glob = require('glob');
11
9
 
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
-
14
- var postcss__default = /*#__PURE__*/_interopDefaultLegacy(postcss);
15
- var postcssModules__default = /*#__PURE__*/_interopDefaultLegacy(postcssModules);
16
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
17
- var sass__default = /*#__PURE__*/_interopDefaultLegacy(sass);
18
- var glob__default = /*#__PURE__*/_interopDefaultLegacy(glob);
19
-
20
10
  const defaultScopedName = "[local]_[hash:base64:6]";
21
11
 
22
12
  /**
@@ -46,7 +36,7 @@ const postCssLoader = async ({code, fiePath, options}) => {
46
36
  const isGlobalStyle = /\.global.(css|scss|sass|less|stylus)$/.test(fiePath);
47
37
 
48
38
  postCssPlugins.unshift(
49
- postcssModules__default["default"]({
39
+ postcssModules({
50
40
  generateScopedName: isGlobalStyle ? "[local]" : classNamePrefix + scopedName,
51
41
  getJSON: (cssFileName, json) => (modulesExported[cssFileName] = json),
52
42
  })
@@ -58,19 +48,19 @@ const postCssLoader = async ({code, fiePath, options}) => {
58
48
  map: false,
59
49
  };
60
50
 
61
- const result = await postcss__default["default"](postCssPlugins).process(code, postcssOptions);
51
+ const result = await postcss(postCssPlugins).process(code, postcssOptions);
62
52
 
63
53
  // collect dependencies
64
54
  const dependencies = [];
65
55
  for (const message of result.messages) {
66
56
  if (message.type === "dependency") {
67
- dependencies.add(message.file);
57
+ dependencies.push(message.file);
68
58
  }
69
59
  }
70
60
 
71
61
  // print postcss warnings
72
62
  for (const warning of result.warnings()) {
73
- console.warn(warning.message || warning.text);
63
+ console.warn(`WARNING: ${warning.plugin}:`, warning.text);
74
64
  }
75
65
 
76
66
  return {
@@ -95,7 +85,7 @@ const defaultLoaders = [
95
85
  {
96
86
  name: "sass",
97
87
  regex: /\.(sass|scss)$/,
98
- process: ({filePath}) => ({code: sass__default["default"].compile(filePath).css.toString()}),
88
+ process: ({filePath}) => ({code: sass.compile(filePath).css.toString()}),
99
89
  },
100
90
  {
101
91
  name: "css",
@@ -130,7 +120,7 @@ const libStylePlugin = (options = {}) => {
130
120
 
131
121
  const postCssResult = await postCssLoader({code: rawCss.code, fiePath: id, options: postCssOptions});
132
122
 
133
- for (const dependence of postCssResult.dependencies) this.addWatchFile(dependence);
123
+ for (const dependency of postCssResult.dependencies) this.addWatchFile(dependency);
134
124
 
135
125
  const cssFilePath = id.replace(process.cwd(), "").replace(/\\/g, "/");
136
126
 
@@ -156,7 +146,7 @@ const libStylePlugin = (options = {}) => {
156
146
  // get all the modules that import CSS files
157
147
  const importersPaths = outputPaths
158
148
  .reduce((result, currentPath) => {
159
- result.push(glob__default["default"].sync(`${currentPath}/**/*.js`));
149
+ result.push(glob.sync(`${currentPath}/**/*.js`));
160
150
  return result
161
151
  }, [])
162
152
  .flat();
@@ -164,11 +154,11 @@ const libStylePlugin = (options = {}) => {
164
154
  // replace magic path with relative path
165
155
  await Promise.all(
166
156
  importersPaths.map((currentPath) =>
167
- fs__default["default"]
157
+ fs
168
158
  .readFile(currentPath)
169
159
  .then((buffer) => buffer.toString())
170
160
  .then(replaceMagicPath)
171
- .then((fileContent) => fs__default["default"].writeFile(currentPath, fileContent))
161
+ .then((fileContent) => fs.writeFile(currentPath, fileContent))
172
162
  )
173
163
  );
174
164
  },
package/package.json CHANGED
@@ -1,68 +1,69 @@
1
- {
2
- "name": "rollup-plugin-lib-style",
3
- "version": "1.2.3",
4
- "description": "A Rollup plugin that converts CSS and extensions for CSS into CSS modules and imports the generated CSS files",
5
- "main": "lib/index.js",
6
- "module": "lib/index.es.js",
7
- "files": [
8
- "lib",
9
- "types/index.d.ts"
10
- ],
11
- "scripts": {
12
- "build": "rollup --input src/index.js --file lib/index.es.js --format es && rollup --input src/index.js --file lib/index.js --format cjs",
13
- "prepublishOnly": "npm run build && npm run test",
14
- "postpublish": "git push && git push --tags",
15
- "publish:beta": "npm version prerelease --preid=beta -m \"beta version - %s\" && npm publish --tag beta",
16
- "publish:patch": "npm version patch -m \"patch version - %s\" && npm publish",
17
- "publish:minor": "npm version minor -m \"minor version - %s\" && npm publish",
18
- "publish:major": "npm version major -m \"major version - %s\" && npm publish",
19
- "lint:fix": "eslint **/*.{js,jsx} --fix",
20
- "lint": "eslint **/*.{js,jsx}",
21
- "test": "jest",
22
- "test:cov": "jest --coverage"
23
- },
24
- "repository": {
25
- "type": "git",
26
- "url": "git+https://github.com/danielamenou/rollup-plugin-lib-style"
27
- },
28
- "keywords": [
29
- "library",
30
- "rollup",
31
- "plugin",
32
- "style",
33
- "sass",
34
- "scss",
35
- "css"
36
- ],
37
- "author": "Daniel Amenou <amenou.daniel@gmail.com>",
38
- "license": "MIT",
39
- "engines": {
40
- "node": ">=16"
41
- },
42
- "types": "./types/index.d.ts",
43
- "devDependencies": {
44
- "@babel/core": "^7.19.3",
45
- "@babel/eslint-parser": "^7.19.1",
46
- "@babel/preset-env": "^7.19.3",
47
- "@types/jest": "^29.1.2",
48
- "babel-core": "^6.26.3",
49
- "babel-jest": "^29.1.2",
50
- "eslint": "^8.25.0",
51
- "eslint-config-prettier": "^8.5.0",
52
- "eslint-config-rem": "^4.0.0",
53
- "eslint-plugin-import": "^2.26.0",
54
- "eslint-plugin-prettier": "^4.2.1",
55
- "eslint-plugin-promise": "^6.0.1",
56
- "fs-extra": "^10.1.0",
57
- "jest": "^29.1.2",
58
- "jest-environment-node-single-context": "^29.0.0",
59
- "prettier": "^2.7.1",
60
- "rollup": "^2.79.1"
61
- },
62
- "dependencies": {
63
- "postcss": "^8.4.17",
64
- "postcss-modules": "^4.0.0",
65
- "rollup-pluginutils": "^2.8.2",
66
- "sass": "^1.55.0"
67
- }
68
- }
1
+ {
2
+ "name": "rollup-plugin-lib-style",
3
+ "version": "1.2.5",
4
+ "description": "A Rollup plugin that converts CSS and extensions for CSS into CSS modules and imports the generated CSS files",
5
+ "main": "lib/index.js",
6
+ "module": "lib/index.es.js",
7
+ "files": [
8
+ "lib",
9
+ "types/index.d.ts"
10
+ ],
11
+ "scripts": {
12
+ "build": "rollup --input src/index.js --file lib/index.es.js --format es && rollup --input src/index.js --file lib/index.js --format cjs",
13
+ "prepublishOnly": "npm run build && npm run test",
14
+ "prepack": "npm run build",
15
+ "postpublish": "git push && git push --tags",
16
+ "publish:beta": "npm version prerelease --preid=beta -m \"beta version - %s\" && npm publish --tag beta",
17
+ "publish:patch": "npm version patch -m \"patch version - %s\" && npm publish",
18
+ "publish:minor": "npm version minor -m \"minor version - %s\" && npm publish",
19
+ "publish:major": "npm version major -m \"major version - %s\" && npm publish",
20
+ "lint:fix": "eslint **/*.{js,jsx} --fix",
21
+ "lint": "eslint **/*.{js,jsx}",
22
+ "test": "jest",
23
+ "test:cov": "jest --coverage"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/danielamenou/rollup-plugin-lib-style"
28
+ },
29
+ "keywords": [
30
+ "library",
31
+ "rollup",
32
+ "plugin",
33
+ "style",
34
+ "sass",
35
+ "scss",
36
+ "css"
37
+ ],
38
+ "author": "Daniel Amenou <amenou.daniel@gmail.com>",
39
+ "license": "MIT",
40
+ "engines": {
41
+ "node": ">=16"
42
+ },
43
+ "types": "./types/index.d.ts",
44
+ "devDependencies": {
45
+ "@babel/core": "^7.20.5",
46
+ "@babel/eslint-parser": "^7.19.1",
47
+ "@babel/preset-env": "^7.20.2",
48
+ "@types/jest": "^29.2.3",
49
+ "babel-core": "^6.26.3",
50
+ "babel-jest": "^29.3.1",
51
+ "eslint": "^8.28.0",
52
+ "eslint-config-prettier": "^8.5.0",
53
+ "eslint-config-rem": "^4.0.0",
54
+ "eslint-plugin-import": "^2.26.0",
55
+ "eslint-plugin-prettier": "^4.2.1",
56
+ "eslint-plugin-promise": "^6.1.1",
57
+ "fs-extra": "^11.0.0",
58
+ "jest": "^29.3.1",
59
+ "jest-environment-node-single-context": "^29.0.0",
60
+ "prettier": "^2.8.0",
61
+ "rollup": "^3.5.0"
62
+ },
63
+ "dependencies": {
64
+ "postcss": "^8.4.19",
65
+ "postcss-modules": "^6.0.0",
66
+ "rollup-pluginutils": "^2.8.2",
67
+ "sass": "^1.56.1"
68
+ }
69
+ }