@atlaspack/optimizer-css 2.14.5-canary.14 → 2.14.5-canary.140
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 +130 -0
- package/lib/CSSOptimizer.d.ts +3 -0
- package/lib/CSSOptimizer.js +14 -3
- package/package.json +12 -8
- package/src/{CSSOptimizer.js → CSSOptimizer.ts} +14 -7
- package/tsconfig.json +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,135 @@
|
|
|
1
1
|
# @atlaspack/optimizer-css
|
|
2
2
|
|
|
3
|
+
## 2.14.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @atlaspack/utils@2.17.3
|
|
9
|
+
- @atlaspack/plugin@2.14.21
|
|
10
|
+
|
|
11
|
+
## 2.14.20
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#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
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
|
|
18
|
+
- @atlaspack/plugin@2.14.20
|
|
19
|
+
- @atlaspack/utils@2.17.2
|
|
20
|
+
|
|
21
|
+
## 2.14.19
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies []:
|
|
26
|
+
- @atlaspack/utils@2.17.1
|
|
27
|
+
- @atlaspack/plugin@2.14.19
|
|
28
|
+
|
|
29
|
+
## 2.14.18
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417), [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56)]:
|
|
34
|
+
- @atlaspack/utils@2.17.0
|
|
35
|
+
- @atlaspack/plugin@2.14.18
|
|
36
|
+
|
|
37
|
+
## 2.14.17
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies []:
|
|
42
|
+
- @atlaspack/utils@2.16.1
|
|
43
|
+
- @atlaspack/plugin@2.14.17
|
|
44
|
+
|
|
45
|
+
## 2.14.16
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
|
|
50
|
+
- @atlaspack/utils@2.16.0
|
|
51
|
+
- @atlaspack/plugin@2.14.16
|
|
52
|
+
|
|
53
|
+
## 2.14.15
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies []:
|
|
58
|
+
- @atlaspack/utils@2.15.3
|
|
59
|
+
- @atlaspack/plugin@2.14.15
|
|
60
|
+
|
|
61
|
+
## 2.14.14
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies []:
|
|
66
|
+
- @atlaspack/utils@2.15.2
|
|
67
|
+
- @atlaspack/plugin@2.14.14
|
|
68
|
+
|
|
69
|
+
## 2.14.13
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies []:
|
|
74
|
+
- @atlaspack/utils@2.15.1
|
|
75
|
+
- @atlaspack/plugin@2.14.13
|
|
76
|
+
|
|
77
|
+
## 2.14.12
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
|
|
82
|
+
- @atlaspack/utils@2.15.0
|
|
83
|
+
- @atlaspack/plugin@2.14.12
|
|
84
|
+
|
|
85
|
+
## 2.14.11
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- Updated dependencies []:
|
|
90
|
+
- @atlaspack/utils@2.14.11
|
|
91
|
+
- @atlaspack/plugin@2.14.11
|
|
92
|
+
|
|
93
|
+
## 2.14.10
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- Updated dependencies []:
|
|
98
|
+
- @atlaspack/plugin@2.14.10
|
|
99
|
+
- @atlaspack/utils@2.14.10
|
|
100
|
+
|
|
101
|
+
## 2.14.9
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- Updated dependencies []:
|
|
106
|
+
- @atlaspack/utils@2.14.9
|
|
107
|
+
- @atlaspack/plugin@2.14.9
|
|
108
|
+
|
|
109
|
+
## 2.14.8
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- Updated dependencies []:
|
|
114
|
+
- @atlaspack/utils@2.14.8
|
|
115
|
+
- @atlaspack/plugin@2.14.8
|
|
116
|
+
|
|
117
|
+
## 2.14.7
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- Updated dependencies []:
|
|
122
|
+
- @atlaspack/utils@2.14.7
|
|
123
|
+
- @atlaspack/plugin@2.14.7
|
|
124
|
+
|
|
125
|
+
## 2.14.6
|
|
126
|
+
|
|
127
|
+
### Patch Changes
|
|
128
|
+
|
|
129
|
+
- Updated dependencies []:
|
|
130
|
+
- @atlaspack/utils@2.14.6
|
|
131
|
+
- @atlaspack/plugin@2.14.6
|
|
132
|
+
|
|
3
133
|
## 2.14.5
|
|
4
134
|
|
|
5
135
|
### Patch Changes
|
package/lib/CSSOptimizer.js
CHANGED
|
@@ -63,7 +63,6 @@ function _diagnostic() {
|
|
|
63
63
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
64
64
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
65
65
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
66
|
-
// $FlowFixMe - init for browser build.
|
|
67
66
|
var _default = exports.default = new (_plugin().Optimizer)({
|
|
68
67
|
async loadConfig({
|
|
69
68
|
config,
|
|
@@ -78,6 +77,7 @@ var _default = exports.default = new (_plugin().Optimizer)({
|
|
|
78
77
|
let codeHighlights;
|
|
79
78
|
let message;
|
|
80
79
|
if (filename === 'package.json') {
|
|
80
|
+
// @ts-expect-error TS2345
|
|
81
81
|
message = (0, _diagnostic().md)`
|
|
82
82
|
Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cssnano" key was found in **package.json**. Either remove this configuration, or configure Parcel to use @atlaspack/optimizer-cssnano instead.
|
|
83
83
|
`;
|
|
@@ -87,6 +87,7 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
87
87
|
type: 'key'
|
|
88
88
|
}]);
|
|
89
89
|
} else {
|
|
90
|
+
// @ts-expect-error TS2345
|
|
90
91
|
message = (0, _diagnostic().md)`Parcel\'s default CSS minifer changed from cssnano to lightningcss, but a __${filename}__ config file was found. Either remove this config file, or configure Parcel to use @atlaspack/optimizer-cssnano instead.`;
|
|
91
92
|
codeHighlights = [{
|
|
92
93
|
start: {
|
|
@@ -138,11 +139,15 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
141
|
let defaultImport = null;
|
|
142
|
+
// @ts-expect-error TS2345
|
|
141
143
|
if (usedSymbols.has('default')) {
|
|
142
144
|
let incoming = bundleGraph.getIncomingDependencies(asset);
|
|
143
|
-
defaultImport = incoming.find(d =>
|
|
145
|
+
defaultImport = incoming.find(d =>
|
|
146
|
+
// @ts-expect-error TS2345
|
|
147
|
+
d.symbols.hasExportSymbol('default'));
|
|
144
148
|
if (defaultImport) {
|
|
145
149
|
var _defaultImport$symbol;
|
|
150
|
+
// @ts-expect-error TS2345
|
|
146
151
|
let loc = (_defaultImport$symbol = defaultImport.symbols.get('default')) === null || _defaultImport$symbol === void 0 ? void 0 : _defaultImport$symbol.loc;
|
|
147
152
|
logger.warn({
|
|
148
153
|
message: 'CSS modules cannot be tree shaken when imported with a default specifier',
|
|
@@ -157,10 +162,13 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
157
162
|
});
|
|
158
163
|
}
|
|
159
164
|
}
|
|
165
|
+
|
|
166
|
+
// @ts-expect-error TS2345
|
|
160
167
|
if (!defaultImport && !usedSymbols.has('*')) {
|
|
161
168
|
for (let [symbol, {
|
|
162
169
|
local
|
|
163
170
|
}] of asset.symbols) {
|
|
171
|
+
// @ts-expect-error TS2367
|
|
164
172
|
if (local !== 'default' && !usedSymbols.has(symbol)) {
|
|
165
173
|
unusedSymbols.push(local);
|
|
166
174
|
}
|
|
@@ -184,8 +192,9 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
184
192
|
}
|
|
185
193
|
}
|
|
186
194
|
|
|
187
|
-
//
|
|
195
|
+
// @ts-expect-error TS2339
|
|
188
196
|
if (process.browser) {
|
|
197
|
+
// @ts-expect-error TS2349
|
|
189
198
|
await (0, _lightningcss().default)();
|
|
190
199
|
}
|
|
191
200
|
let result = (0, _lightningcss().transform)({
|
|
@@ -202,6 +211,7 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
202
211
|
map = new (_sourceMap().default)(options.projectRoot);
|
|
203
212
|
map.addVLQMap(vlqMap);
|
|
204
213
|
if (prevMap) {
|
|
214
|
+
// @ts-expect-error TS2345
|
|
205
215
|
map.extends(prevMap);
|
|
206
216
|
}
|
|
207
217
|
}
|
|
@@ -209,6 +219,7 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
209
219
|
if (bundle.env.sourceMap) {
|
|
210
220
|
let reference = await getSourceMapReference(map);
|
|
211
221
|
if (reference != null) {
|
|
222
|
+
// @ts-expect-error TS2322
|
|
212
223
|
contents = contents.toString() + '\n' + '/*# sourceMappingURL=' + reference + ' */\n';
|
|
213
224
|
}
|
|
214
225
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/optimizer-css",
|
|
3
|
-
"version": "2.14.5-canary.
|
|
3
|
+
"version": "2.14.5-canary.140+43fdd2238",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
11
11
|
},
|
|
12
|
-
"main": "lib/CSSOptimizer.js",
|
|
13
|
-
"source": "src/CSSOptimizer.
|
|
12
|
+
"main": "./lib/CSSOptimizer.js",
|
|
13
|
+
"source": "./src/CSSOptimizer.ts",
|
|
14
|
+
"types": "./lib/CSSOptimizer.d.ts",
|
|
14
15
|
"engines": {
|
|
15
16
|
"node": ">= 16.0.0"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@atlaspack/diagnostic": "2.14.1-canary.
|
|
19
|
-
"@atlaspack/plugin": "2.14.5-canary.
|
|
20
|
-
"@atlaspack/utils": "2.14.5-canary.
|
|
19
|
+
"@atlaspack/diagnostic": "2.14.1-canary.208+43fdd2238",
|
|
20
|
+
"@atlaspack/plugin": "2.14.5-canary.140+43fdd2238",
|
|
21
|
+
"@atlaspack/utils": "2.14.5-canary.140+43fdd2238",
|
|
21
22
|
"@parcel/source-map": "^2.1.1",
|
|
22
23
|
"browserslist": "^4.6.6",
|
|
23
24
|
"lightningcss": "^1.28.2",
|
|
@@ -30,5 +31,8 @@
|
|
|
30
31
|
"lightningcss": "lightningcss-wasm"
|
|
31
32
|
},
|
|
32
33
|
"type": "commonjs",
|
|
33
|
-
"
|
|
34
|
-
|
|
34
|
+
"scripts": {
|
|
35
|
+
"check-ts": "tsc --emitDeclarationOnly --rootDir src"
|
|
36
|
+
},
|
|
37
|
+
"gitHead": "43fdd223860fbc97af17d68c65419b97412cb888"
|
|
38
|
+
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
// @flow strict-local
|
|
2
|
-
|
|
3
1
|
import SourceMap from '@parcel/source-map';
|
|
4
2
|
import {Optimizer} from '@atlaspack/plugin';
|
|
5
|
-
// $FlowFixMe - init for browser build.
|
|
6
3
|
import init, {
|
|
7
4
|
transform,
|
|
8
5
|
transformStyleAttribute,
|
|
@@ -18,7 +15,7 @@ import {
|
|
|
18
15
|
generateJSONCodeHighlights,
|
|
19
16
|
} from '@atlaspack/diagnostic';
|
|
20
17
|
|
|
21
|
-
export default
|
|
18
|
+
export default new Optimizer({
|
|
22
19
|
async loadConfig({config, logger, options}) {
|
|
23
20
|
const configFile = await config.getConfig(
|
|
24
21
|
[
|
|
@@ -36,6 +33,7 @@ export default (new Optimizer({
|
|
|
36
33
|
let codeHighlights;
|
|
37
34
|
let message;
|
|
38
35
|
if (filename === 'package.json') {
|
|
36
|
+
// @ts-expect-error TS2345
|
|
39
37
|
message = md`
|
|
40
38
|
Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cssnano" key was found in **package.json**. Either remove this configuration, or configure Parcel to use @atlaspack/optimizer-cssnano instead.
|
|
41
39
|
`;
|
|
@@ -47,6 +45,7 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
47
45
|
{key: '/cssnano', type: 'key'},
|
|
48
46
|
]);
|
|
49
47
|
} else {
|
|
48
|
+
// @ts-expect-error TS2345
|
|
50
49
|
message = md`Parcel\'s default CSS minifer changed from cssnano to lightningcss, but a __${filename}__ config file was found. Either remove this config file, or configure Parcel to use @atlaspack/optimizer-cssnano instead.`;
|
|
51
50
|
codeHighlights = [
|
|
52
51
|
{
|
|
@@ -101,12 +100,15 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
let defaultImport = null;
|
|
103
|
+
// @ts-expect-error TS2345
|
|
104
104
|
if (usedSymbols.has('default')) {
|
|
105
105
|
let incoming = bundleGraph.getIncomingDependencies(asset);
|
|
106
106
|
defaultImport = incoming.find((d) =>
|
|
107
|
+
// @ts-expect-error TS2345
|
|
107
108
|
d.symbols.hasExportSymbol('default'),
|
|
108
109
|
);
|
|
109
110
|
if (defaultImport) {
|
|
111
|
+
// @ts-expect-error TS2345
|
|
110
112
|
let loc = defaultImport.symbols.get('default')?.loc;
|
|
111
113
|
logger.warn({
|
|
112
114
|
message:
|
|
@@ -130,8 +132,10 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
134
|
|
|
135
|
+
// @ts-expect-error TS2345
|
|
133
136
|
if (!defaultImport && !usedSymbols.has('*')) {
|
|
134
137
|
for (let [symbol, {local}] of asset.symbols) {
|
|
138
|
+
// @ts-expect-error TS2367
|
|
135
139
|
if (local !== 'default' && !usedSymbols.has(symbol)) {
|
|
136
140
|
unusedSymbols.push(local);
|
|
137
141
|
}
|
|
@@ -156,8 +160,9 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
162
|
|
|
159
|
-
//
|
|
163
|
+
// @ts-expect-error TS2339
|
|
160
164
|
if (process.browser) {
|
|
165
|
+
// @ts-expect-error TS2349
|
|
161
166
|
await init();
|
|
162
167
|
}
|
|
163
168
|
|
|
@@ -176,6 +181,7 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
176
181
|
map = new SourceMap(options.projectRoot);
|
|
177
182
|
map.addVLQMap(vlqMap);
|
|
178
183
|
if (prevMap) {
|
|
184
|
+
// @ts-expect-error TS2345
|
|
179
185
|
map.extends(prevMap);
|
|
180
186
|
}
|
|
181
187
|
}
|
|
@@ -184,6 +190,7 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
184
190
|
if (bundle.env.sourceMap) {
|
|
185
191
|
let reference = await getSourceMapReference(map);
|
|
186
192
|
if (reference != null) {
|
|
193
|
+
// @ts-expect-error TS2322
|
|
187
194
|
contents =
|
|
188
195
|
contents.toString() +
|
|
189
196
|
'\n' +
|
|
@@ -198,11 +205,11 @@ Atlaspack\'s default CSS minifer changed from cssnano to lightningcss, but a "cs
|
|
|
198
205
|
map,
|
|
199
206
|
};
|
|
200
207
|
},
|
|
201
|
-
})
|
|
208
|
+
}) as Optimizer<unknown, unknown>;
|
|
202
209
|
|
|
203
210
|
let cache = new Map();
|
|
204
211
|
|
|
205
|
-
function getTargets(browsers) {
|
|
212
|
+
function getTargets(browsers: undefined | string | Array<string>) {
|
|
206
213
|
if (browsers == null) {
|
|
207
214
|
return undefined;
|
|
208
215
|
}
|
package/tsconfig.json
ADDED