@pi-r/postcss 0.11.3 → 0.12.1
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/index.js +8 -6
- package/package.json +3 -6
package/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const autoprefixer = require('autoprefixer');
|
|
5
|
+
const cssImport = require('postcss-import');
|
|
6
|
+
const { isObject, loadPlugins } = require('@e-mc/document/util');
|
|
6
7
|
const PLUGIN_MAP = Object.freeze({
|
|
7
8
|
'autoprefixer': autoprefixer,
|
|
8
9
|
'import': cssImport,
|
|
@@ -30,7 +31,7 @@ async function transform(context, value, options) {
|
|
|
30
31
|
sourceMap.reset();
|
|
31
32
|
}
|
|
32
33
|
else if (sourceMap.map) {
|
|
33
|
-
if (
|
|
34
|
+
if (isObject(map)) {
|
|
34
35
|
map.prev = sourceMap.map;
|
|
35
36
|
}
|
|
36
37
|
else {
|
|
@@ -40,7 +41,7 @@ async function transform(context, value, options) {
|
|
|
40
41
|
if (Array.isArray(plugins)) {
|
|
41
42
|
delete baseConfig.plugins;
|
|
42
43
|
Object.assign(baseConfig, { from: targetFile, to: targetFile });
|
|
43
|
-
const result = await context(
|
|
44
|
+
const result = await context(loadPlugins(plugins, PLUGIN_MAP)).process(value, baseConfig);
|
|
44
45
|
if (result) {
|
|
45
46
|
if (result.map) {
|
|
46
47
|
sourceMap.nextMap('postcss', result.css, result.map.toJSON());
|
|
@@ -49,4 +50,5 @@ async function transform(context, value, options) {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
}
|
|
53
|
+
|
|
52
54
|
module.exports = transform;
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/postcss",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "PostCSS transform function for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
6
|
"repository": {
|
|
10
7
|
"type": "git",
|
|
11
8
|
"url": "git+https://github.com/anpham6/pi-r.git",
|
|
@@ -19,9 +16,9 @@
|
|
|
19
16
|
"license": "MIT",
|
|
20
17
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
21
18
|
"dependencies": {
|
|
22
|
-
"@e-mc/document": "^0.
|
|
19
|
+
"@e-mc/document": "^0.14.1",
|
|
23
20
|
"autoprefixer": "*",
|
|
24
|
-
"postcss": "^8.5.
|
|
21
|
+
"postcss": "^8.5.14",
|
|
25
22
|
"postcss-import": "*"
|
|
26
23
|
}
|
|
27
24
|
}
|