@atlaspack/transformer-postcss 2.14.19 → 2.14.20
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/CHANGELOG.md +10 -0
- package/lib/PostCSSTransformer.js +15 -2
- package/package.json +3 -3
- package/src/PostCSSTransformer.js +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaspack/transformer-postcss
|
|
2
2
|
|
|
3
|
+
## 2.14.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#702](https://github.com/atlassian-labs/atlaspack/pull/702) [`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa) Thanks [@alshdavid](https://github.com/alshdavid)! - Fixes to Flow types
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
|
|
10
|
+
- @atlaspack/plugin@2.14.20
|
|
11
|
+
- @atlaspack/utils@2.17.2
|
|
12
|
+
|
|
3
13
|
## 2.14.19
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -132,16 +132,23 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
132
132
|
const postcss = await loadPostcss(options, asset.filePath);
|
|
133
133
|
let ast = (0, _nullthrows().default)(await asset.getAST());
|
|
134
134
|
let program = postcss.fromJSON(ast.program);
|
|
135
|
+
|
|
136
|
+
// $FlowFixMe
|
|
135
137
|
let plugins = [...config.hydrated.plugins];
|
|
136
138
|
let cssModules = null;
|
|
139
|
+
// $FlowFixMe
|
|
137
140
|
if (config.hydrated.modules) {
|
|
138
141
|
asset.meta.cssModulesCompiled = 'postcss';
|
|
139
142
|
let code = asset.isASTDirty() ? null : await asset.getCode();
|
|
140
|
-
if (
|
|
143
|
+
if (
|
|
144
|
+
// $FlowFixMe
|
|
145
|
+
Object.keys(config.hydrated.modules).length === 0 && code && !isLegacy && !LEGACY_MODULE_RE.test(code)) {
|
|
146
|
+
// $FlowFixMe
|
|
141
147
|
let filename = _path().default.basename(config.filePath);
|
|
142
148
|
let message;
|
|
143
149
|
let configKey;
|
|
144
150
|
let hint;
|
|
151
|
+
// $FlowFixMe
|
|
145
152
|
if (config.raw.modules) {
|
|
146
153
|
message = (0, _diagnostic().md)`The "modules" option in __${filename}__ can be replaced with configuration for @atlaspack/transformer-css to improve build performance.`;
|
|
147
154
|
configKey = '/modules';
|
|
@@ -163,9 +170,11 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
163
170
|
}
|
|
164
171
|
let codeFrames;
|
|
165
172
|
if (_path().default.extname(filename) !== '.js') {
|
|
173
|
+
// $FlowFixMe
|
|
166
174
|
let contents = await asset.fs.readFile(config.filePath, 'utf8');
|
|
167
175
|
codeFrames = [{
|
|
168
176
|
language: 'json',
|
|
177
|
+
// $FlowFixMe
|
|
169
178
|
filePath: config.filePath,
|
|
170
179
|
code: contents,
|
|
171
180
|
codeHighlights: (0, _diagnostic().generateJSONCodeHighlights)(contents, [{
|
|
@@ -175,6 +184,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
175
184
|
}];
|
|
176
185
|
} else {
|
|
177
186
|
codeFrames = [{
|
|
187
|
+
// $FlowFixMe
|
|
178
188
|
filePath: config.filePath,
|
|
179
189
|
codeHighlights: [{
|
|
180
190
|
start: {
|
|
@@ -206,6 +216,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
206
216
|
getJSON: (filename, json) => cssModules = json,
|
|
207
217
|
Loader: await createLoader(asset, resolve, options),
|
|
208
218
|
generateScopedName: (name, filename) => `${name}_${(0, _rust().hashString)(_path().default.relative(options.projectRoot, filename)).substr(0, 6)}`,
|
|
219
|
+
// $FlowFixMe
|
|
209
220
|
...config.hydrated.modules
|
|
210
221
|
}));
|
|
211
222
|
if (code == null || COMPOSES_RE.test(code)) {
|
|
@@ -238,7 +249,9 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
238
249
|
let {
|
|
239
250
|
messages,
|
|
240
251
|
root
|
|
241
|
-
} = await postcss(plugins).process(program,
|
|
252
|
+
} = await postcss(plugins).process(program,
|
|
253
|
+
// $FlowFixMe
|
|
254
|
+
config.hydrated);
|
|
242
255
|
asset.setAST({
|
|
243
256
|
type: 'postcss',
|
|
244
257
|
version: '8.2.1',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/transformer-postcss",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.20",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@atlaspack/diagnostic": "2.14.1",
|
|
19
|
-
"@atlaspack/plugin": "2.14.
|
|
19
|
+
"@atlaspack/plugin": "2.14.20",
|
|
20
20
|
"@atlaspack/rust": "3.4.1",
|
|
21
|
-
"@atlaspack/utils": "2.17.
|
|
21
|
+
"@atlaspack/utils": "2.17.2",
|
|
22
22
|
"clone": "^2.1.1",
|
|
23
23
|
"nullthrows": "^1.1.1",
|
|
24
24
|
"postcss-value-parser": "^4.2.0",
|
|
@@ -81,22 +81,27 @@ export default (new Transformer({
|
|
|
81
81
|
let ast = nullthrows(await asset.getAST());
|
|
82
82
|
let program = postcss.fromJSON(ast.program);
|
|
83
83
|
|
|
84
|
+
// $FlowFixMe
|
|
84
85
|
let plugins = [...config.hydrated.plugins];
|
|
85
86
|
let cssModules: ?{|[string]: string|} = null;
|
|
87
|
+
// $FlowFixMe
|
|
86
88
|
if (config.hydrated.modules) {
|
|
87
89
|
asset.meta.cssModulesCompiled = 'postcss';
|
|
88
90
|
|
|
89
91
|
let code = asset.isASTDirty() ? null : await asset.getCode();
|
|
90
92
|
if (
|
|
93
|
+
// $FlowFixMe
|
|
91
94
|
Object.keys(config.hydrated.modules).length === 0 &&
|
|
92
95
|
code &&
|
|
93
96
|
!isLegacy &&
|
|
94
97
|
!LEGACY_MODULE_RE.test(code)
|
|
95
98
|
) {
|
|
99
|
+
// $FlowFixMe
|
|
96
100
|
let filename = path.basename(config.filePath);
|
|
97
101
|
let message;
|
|
98
102
|
let configKey;
|
|
99
103
|
let hint;
|
|
104
|
+
// $FlowFixMe
|
|
100
105
|
if (config.raw.modules) {
|
|
101
106
|
message = md`The "modules" option in __${filename}__ can be replaced with configuration for @atlaspack/transformer-css to improve build performance.`;
|
|
102
107
|
configKey = '/modules';
|
|
@@ -122,10 +127,12 @@ export default (new Transformer({
|
|
|
122
127
|
|
|
123
128
|
let codeFrames;
|
|
124
129
|
if (path.extname(filename) !== '.js') {
|
|
130
|
+
// $FlowFixMe
|
|
125
131
|
let contents = await asset.fs.readFile(config.filePath, 'utf8');
|
|
126
132
|
codeFrames = [
|
|
127
133
|
{
|
|
128
134
|
language: 'json',
|
|
135
|
+
// $FlowFixMe
|
|
129
136
|
filePath: config.filePath,
|
|
130
137
|
code: contents,
|
|
131
138
|
codeHighlights: generateJSONCodeHighlights(contents, [
|
|
@@ -139,6 +146,7 @@ export default (new Transformer({
|
|
|
139
146
|
} else {
|
|
140
147
|
codeFrames = [
|
|
141
148
|
{
|
|
149
|
+
// $FlowFixMe
|
|
142
150
|
filePath: config.filePath,
|
|
143
151
|
codeHighlights: [
|
|
144
152
|
{
|
|
@@ -178,6 +186,7 @@ export default (new Transformer({
|
|
|
178
186
|
`${name}_${hashString(
|
|
179
187
|
path.relative(options.projectRoot, filename),
|
|
180
188
|
).substr(0, 6)}`,
|
|
189
|
+
// $FlowFixMe
|
|
181
190
|
...config.hydrated.modules,
|
|
182
191
|
}),
|
|
183
192
|
);
|
|
@@ -212,6 +221,7 @@ export default (new Transformer({
|
|
|
212
221
|
// $FlowFixMe Added in Flow 0.121.0 upgrade in #4381
|
|
213
222
|
let {messages, root} = await postcss(plugins).process(
|
|
214
223
|
program,
|
|
224
|
+
// $FlowFixMe
|
|
215
225
|
config.hydrated,
|
|
216
226
|
);
|
|
217
227
|
asset.setAST({
|
|
@@ -286,7 +296,7 @@ export default (new Transformer({
|
|
|
286
296
|
content: code,
|
|
287
297
|
};
|
|
288
298
|
},
|
|
289
|
-
}): Transformer);
|
|
299
|
+
}): Transformer<mixed>);
|
|
290
300
|
|
|
291
301
|
async function createLoader(
|
|
292
302
|
asset: MutableAsset,
|