@atomicsmash/compiler 0.2.1 → 0.2.3
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -17
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAqBA,OAAO,CAAC,MAAM,CAAC;IAEd,UAAU,MAAM,CAAC;QAEhB,UAAU,UAAU;YACnB,QAAQ,EAAE,YAAY,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;SAC5D;KACD;CACD"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { sep as pathSeparator, extname, resolve as resolvePath, } from "node:path";
|
|
3
3
|
import DependencyExtractionWebpackPlugin from "@wordpress/dependency-extraction-webpack-plugin";
|
|
4
4
|
import CopyPlugin from "copy-webpack-plugin";
|
|
5
|
+
import cssNano from "cssnano";
|
|
5
6
|
import glob from "fast-glob";
|
|
7
|
+
import postCSSPresetEnv from "postcss-preset-env";
|
|
6
8
|
import SVGSpritemapPlugin from "svg-spritemap-webpack-plugin";
|
|
7
9
|
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
|
|
8
10
|
import webpack from "webpack";
|
|
@@ -42,24 +44,33 @@ const srcFolder = resolvePath(argv.in);
|
|
|
42
44
|
const distFolder = resolvePath(argv.out);
|
|
43
45
|
// @ts-expect-error -- Module doesn't need to be installed in compiler package.
|
|
44
46
|
const tailwindPostCSSPlugin = await import("@tailwindcss/postcss")
|
|
45
|
-
.then(() => [
|
|
47
|
+
.then((tailwindPostCSS) => [
|
|
48
|
+
tailwindPostCSS.default,
|
|
49
|
+
])
|
|
46
50
|
.catch(async () =>
|
|
47
51
|
// @ts-expect-error -- Module doesn't need to be installed in compiler package.
|
|
48
|
-
await import("tailwindcss")
|
|
52
|
+
await import("tailwindcss")
|
|
53
|
+
.then((tailwindcss) => [tailwindcss.default])
|
|
54
|
+
.catch(() => []));
|
|
49
55
|
const postCSSConfig = [
|
|
50
56
|
[
|
|
51
57
|
...tailwindPostCSSPlugin,
|
|
52
|
-
|
|
53
|
-
{
|
|
58
|
+
postCSSPresetEnv({
|
|
54
59
|
stage: 2,
|
|
55
60
|
features: {
|
|
56
61
|
"custom-media-queries": true,
|
|
57
62
|
},
|
|
58
|
-
},
|
|
63
|
+
}),
|
|
59
64
|
],
|
|
60
|
-
...(MODE === "production" ? [
|
|
65
|
+
...(MODE === "production" ? [cssNano] : []),
|
|
61
66
|
];
|
|
62
67
|
const compiler = webpack({
|
|
68
|
+
resolveLoader: {
|
|
69
|
+
modules: [
|
|
70
|
+
"node_modules",
|
|
71
|
+
resolvePath(import.meta.dirname, "../", "node_modules"),
|
|
72
|
+
],
|
|
73
|
+
},
|
|
63
74
|
devtool: MODE === "development" ? "source-map" : false,
|
|
64
75
|
mode: MODE,
|
|
65
76
|
experiments: {
|
|
@@ -100,7 +111,7 @@ const compiler = webpack({
|
|
|
100
111
|
use: {
|
|
101
112
|
loader: "babel-loader",
|
|
102
113
|
options: {
|
|
103
|
-
presets: [
|
|
114
|
+
presets: ["@babel/preset-typescript", "@babel/preset-env"],
|
|
104
115
|
},
|
|
105
116
|
},
|
|
106
117
|
exclude: /node_modules/,
|
|
@@ -203,11 +214,6 @@ const compiler = webpack({
|
|
|
203
214
|
combineAssets: true,
|
|
204
215
|
}),
|
|
205
216
|
],
|
|
206
|
-
optimization: {
|
|
207
|
-
splitChunks: {
|
|
208
|
-
chunks: "all",
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
217
|
});
|
|
212
218
|
if (argv.watch) {
|
|
213
219
|
const watching = compiler.watch({
|
|
@@ -225,10 +231,18 @@ if (argv.watch) {
|
|
|
225
231
|
else if (stats) {
|
|
226
232
|
const info = stats.toJson();
|
|
227
233
|
if (stats.hasErrors()) {
|
|
228
|
-
|
|
234
|
+
const errors = info.errors;
|
|
235
|
+
console.warn("The compiler produced the following errors: \n");
|
|
236
|
+
for (const error of errors) {
|
|
237
|
+
console.warn(error.message);
|
|
238
|
+
}
|
|
229
239
|
}
|
|
230
240
|
if (stats.hasWarnings()) {
|
|
231
|
-
|
|
241
|
+
const warnings = info.warnings;
|
|
242
|
+
console.warn("The compiler produced the following warnings: \n");
|
|
243
|
+
for (const warning of warnings) {
|
|
244
|
+
console.warn(warning.message);
|
|
245
|
+
}
|
|
232
246
|
}
|
|
233
247
|
}
|
|
234
248
|
});
|
|
@@ -247,12 +261,22 @@ else {
|
|
|
247
261
|
else if (stats) {
|
|
248
262
|
const info = stats.toJson();
|
|
249
263
|
if (stats.hasErrors()) {
|
|
250
|
-
|
|
264
|
+
const errors = info.errors;
|
|
265
|
+
console.warn("The compiler produced the following errors: \n");
|
|
266
|
+
for (const error of errors) {
|
|
267
|
+
console.warn(error.message);
|
|
268
|
+
}
|
|
251
269
|
process.exitCode = 1;
|
|
252
270
|
}
|
|
253
271
|
if (stats.hasWarnings()) {
|
|
254
|
-
|
|
255
|
-
|
|
272
|
+
const warnings = info.warnings;
|
|
273
|
+
console.warn("The compiler produced the following warnings: \n");
|
|
274
|
+
for (const warning of warnings) {
|
|
275
|
+
console.warn(warning.message);
|
|
276
|
+
}
|
|
277
|
+
if (!stats.hasErrors()) {
|
|
278
|
+
process.exitCode = 2;
|
|
279
|
+
}
|
|
256
280
|
}
|
|
257
281
|
}
|
|
258
282
|
compiler.close((closeError) => {
|