@atomicsmash/compiler 0.2.1 → 0.2.2
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 -12
- 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/,
|
|
@@ -225,10 +236,18 @@ if (argv.watch) {
|
|
|
225
236
|
else if (stats) {
|
|
226
237
|
const info = stats.toJson();
|
|
227
238
|
if (stats.hasErrors()) {
|
|
228
|
-
|
|
239
|
+
const errors = info.errors;
|
|
240
|
+
console.warn("The compiler produced the following errors: \n");
|
|
241
|
+
for (const error of errors) {
|
|
242
|
+
console.warn(error.message);
|
|
243
|
+
}
|
|
229
244
|
}
|
|
230
245
|
if (stats.hasWarnings()) {
|
|
231
|
-
|
|
246
|
+
const warnings = info.warnings;
|
|
247
|
+
console.warn("The compiler produced the following warnings: \n");
|
|
248
|
+
for (const warning of warnings) {
|
|
249
|
+
console.warn(warning.message);
|
|
250
|
+
}
|
|
232
251
|
}
|
|
233
252
|
}
|
|
234
253
|
});
|
|
@@ -247,12 +266,22 @@ else {
|
|
|
247
266
|
else if (stats) {
|
|
248
267
|
const info = stats.toJson();
|
|
249
268
|
if (stats.hasErrors()) {
|
|
250
|
-
|
|
269
|
+
const errors = info.errors;
|
|
270
|
+
console.warn("The compiler produced the following errors: \n");
|
|
271
|
+
for (const error of errors) {
|
|
272
|
+
console.warn(error.message);
|
|
273
|
+
}
|
|
251
274
|
process.exitCode = 1;
|
|
252
275
|
}
|
|
253
276
|
if (stats.hasWarnings()) {
|
|
254
|
-
|
|
255
|
-
|
|
277
|
+
const warnings = info.warnings;
|
|
278
|
+
console.warn("The compiler produced the following warnings: \n");
|
|
279
|
+
for (const warning of warnings) {
|
|
280
|
+
console.warn(warning.message);
|
|
281
|
+
}
|
|
282
|
+
if (!stats.hasErrors()) {
|
|
283
|
+
process.exitCode = 2;
|
|
284
|
+
}
|
|
256
285
|
}
|
|
257
286
|
}
|
|
258
287
|
compiler.close((closeError) => {
|