@parcel/transformer-less 2.0.0-beta.2 → 2.0.0-nightly.1004
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/LessTransformer.js +8 -15
- package/lib/loadConfig.js +3 -3
- package/package.json +6 -6
- package/src/LessTransformer.js +3 -2
- package/src/loadConfig.js +12 -3
package/lib/LessTransformer.js
CHANGED
|
@@ -45,15 +45,7 @@ function _less() {
|
|
|
45
45
|
return data;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
const data = require("./loadConfig");
|
|
50
|
-
|
|
51
|
-
_loadConfig = function () {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
48
|
+
var _loadConfig = require("./loadConfig");
|
|
57
49
|
|
|
58
50
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
59
51
|
|
|
@@ -64,7 +56,7 @@ var _default = new (_plugin().Transformer)({
|
|
|
64
56
|
loadConfig({
|
|
65
57
|
config
|
|
66
58
|
}) {
|
|
67
|
-
return (0, _loadConfig
|
|
59
|
+
return (0, _loadConfig.load)({
|
|
68
60
|
config
|
|
69
61
|
});
|
|
70
62
|
},
|
|
@@ -109,7 +101,7 @@ var _default = new (_plugin().Transformer)({
|
|
|
109
101
|
if (result.map != null) {
|
|
110
102
|
let map = new (_sourceMap().default)(options.projectRoot);
|
|
111
103
|
let rawMap = JSON.parse(result.map);
|
|
112
|
-
map.
|
|
104
|
+
map.addVLQMap({ ...rawMap,
|
|
113
105
|
sources: rawMap.sources.map(s => _path().default.relative(options.projectRoot, s))
|
|
114
106
|
});
|
|
115
107
|
asset.setMap(map);
|
|
@@ -136,13 +128,14 @@ function urlPlugin({
|
|
|
136
128
|
|
|
137
129
|
if (!stringValue.startsWith('#') // IE's `behavior: url(#default#VML)`)
|
|
138
130
|
) {
|
|
139
|
-
|
|
140
|
-
|
|
131
|
+
valueNode.value = asset.addURLDependency(stringValue, {});
|
|
132
|
+
}
|
|
141
133
|
|
|
142
134
|
return node;
|
|
143
135
|
}
|
|
144
136
|
|
|
145
|
-
});
|
|
137
|
+
}); // $FlowFixMe[method-unbinding]
|
|
138
|
+
|
|
146
139
|
visitor.run = visitor.visit;
|
|
147
140
|
pluginManager.addVisitor(visitor);
|
|
148
141
|
}
|
|
@@ -217,7 +210,7 @@ function resolvePathPlugin({
|
|
|
217
210
|
}
|
|
218
211
|
|
|
219
212
|
if (filePath) {
|
|
220
|
-
asset.
|
|
213
|
+
asset.invalidateOnFileChange(filePath);
|
|
221
214
|
}
|
|
222
215
|
|
|
223
216
|
return {
|
package/lib/loadConfig.js
CHANGED
|
@@ -40,11 +40,11 @@ async function load({
|
|
|
40
40
|
let isDynamic = configFile && _path().default.extname(configFile.filePath) === '.js';
|
|
41
41
|
|
|
42
42
|
if (isDynamic) {
|
|
43
|
-
config.
|
|
43
|
+
config.invalidateOnStartup();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
return
|
|
46
|
+
return {
|
|
47
47
|
isStatic: !isDynamic,
|
|
48
48
|
config: configContents
|
|
49
|
-
}
|
|
49
|
+
};
|
|
50
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/transformer-less",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-nightly.1004+47379bf8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"source": "src/LessTransformer.js",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">= 12.0.0",
|
|
20
|
-
"parcel": "
|
|
20
|
+
"parcel": "2.0.0-nightly.1002+47379bf8"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/plugin": "2.0.0-
|
|
24
|
-
"@parcel/source-map": "2.0.0
|
|
25
|
-
"less": "^
|
|
23
|
+
"@parcel/plugin": "2.0.0-nightly.1004+47379bf8",
|
|
24
|
+
"@parcel/source-map": "^2.0.0",
|
|
25
|
+
"less": "^4.1.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "47379bf8fabeb2cfe03ade8802d942388b153e5b"
|
|
28
28
|
}
|
package/src/LessTransformer.js
CHANGED
|
@@ -56,7 +56,7 @@ export default (new Transformer({
|
|
|
56
56
|
if (result.map != null) {
|
|
57
57
|
let map = new SourceMap(options.projectRoot);
|
|
58
58
|
let rawMap = JSON.parse(result.map);
|
|
59
|
-
map.
|
|
59
|
+
map.addVLQMap({
|
|
60
60
|
...rawMap,
|
|
61
61
|
sources: rawMap.sources.map(s => path.relative(options.projectRoot, s)),
|
|
62
62
|
});
|
|
@@ -88,6 +88,7 @@ function urlPlugin({asset}) {
|
|
|
88
88
|
},
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
+
// $FlowFixMe[method-unbinding]
|
|
91
92
|
visitor.run = visitor.visit;
|
|
92
93
|
pluginManager.addVisitor(visitor);
|
|
93
94
|
},
|
|
@@ -156,7 +157,7 @@ function resolvePathPlugin({asset, resolve}) {
|
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
if (filePath) {
|
|
159
|
-
asset.
|
|
160
|
+
asset.invalidateOnFileChange(filePath);
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
return {
|
package/src/loadConfig.js
CHANGED
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
import type {Config} from '@parcel/types';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type ConfigResult = {|
|
|
6
|
+
isStatic: boolean,
|
|
7
|
+
config: any,
|
|
8
|
+
|};
|
|
9
|
+
|
|
10
|
+
export async function load({
|
|
11
|
+
config,
|
|
12
|
+
}: {|
|
|
13
|
+
config: Config,
|
|
14
|
+
|}): Promise<ConfigResult> {
|
|
6
15
|
let configFile = await config.getConfig(['.lessrc', '.lessrc.js'], {
|
|
7
16
|
packageKey: 'less',
|
|
8
17
|
});
|
|
@@ -26,8 +35,8 @@ export async function load({config}: {|config: Config|}): Promise<void> {
|
|
|
26
35
|
// This should enforce the config to be reloaded on every run as it's JS
|
|
27
36
|
let isDynamic = configFile && path.extname(configFile.filePath) === '.js';
|
|
28
37
|
if (isDynamic) {
|
|
29
|
-
config.
|
|
38
|
+
config.invalidateOnStartup();
|
|
30
39
|
}
|
|
31
40
|
|
|
32
|
-
return
|
|
41
|
+
return {isStatic: !isDynamic, config: configContents};
|
|
33
42
|
}
|