@atomicsmash/compiler 1.0.1-beta.1 → 1.1.0-beta.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/config.d.ts CHANGED
@@ -9,6 +9,7 @@ import webpack from "webpack";
9
9
  import { WebpackAssetsManifest } from "webpack-assets-manifest";
10
10
  import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
11
11
  import { BlocksPlugin } from "./BlocksPlugin.js";
12
+ import { SCSSAliases } from "./index.js";
12
13
  export declare function config(options: {
13
14
  /**
14
15
  * The directory where the source files can be found. Relative to cwd.
@@ -110,11 +111,7 @@ export declare function config(options: {
110
111
  loader: string;
111
112
  options: {
112
113
  sourceMap: boolean;
113
- sassOptions: {
114
- importers: {
115
- findFileUrl(url: string): import("url").URL | null;
116
- }[];
117
- };
114
+ sassOptions: SCSSAliases;
118
115
  postcssOptions?: undefined;
119
116
  };
120
117
  })[];
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,QAAQ,EAAe,MAAM,SAAS,CAAC;AAQpE,OAAO,iCAAiC,MAAM,iDAAiD,CAAC;AAEhG,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,kBAAkB,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,wBAAsB,MAAM,CAAC,OAAO,EAAE;IACrC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AEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChD;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCA6K6B,QAAQ;;;;;;;;;;;qCAeX,QAAQ;;;;;;;;;;sCA1OrB,CAAC;;;;;;;;;;;;;;;;;;;;;GAyad"}
package/dist/config.js CHANGED
@@ -3,6 +3,7 @@ import { pathToFileURL } from "node:url";
3
3
  import DependencyExtractionWebpackPlugin from "@wordpress/dependency-extraction-webpack-plugin";
4
4
  import browserslistToEsbuild from "browserslist-to-esbuild";
5
5
  import CopyPlugin from "copy-webpack-plugin";
6
+ import { cosmiconfig } from "cosmiconfig";
6
7
  import cssNano from "cssnano";
7
8
  import { EsbuildPlugin } from "esbuild-loader";
8
9
  import glob from "fast-glob";
@@ -225,18 +226,7 @@ export async function config(options) {
225
226
  loader: "sass-loader",
226
227
  options: {
227
228
  sourceMap: MODE === "development",
228
- sassOptions: {
229
- importers: [
230
- {
231
- findFileUrl(url) {
232
- if (!url.startsWith("sitecss:"))
233
- return null;
234
- const pathname = url.substring(8);
235
- return pathToFileURL(`${srcFolder}/styles${pathname.startsWith("/") ? pathname : `/${pathname}`}`);
236
- },
237
- },
238
- ],
239
- },
229
+ sassOptions: await getSassOptions(srcFolder),
240
230
  },
241
231
  },
242
232
  ],
@@ -377,3 +367,52 @@ export async function config(options) {
377
367
  },
378
368
  };
379
369
  }
370
+ async function getSassOptions(srcFolder) {
371
+ const explorer = cosmiconfig("scssAliases");
372
+ const config = await explorer
373
+ .load(resolvePath(process.cwd(), "scssAliases.config.ts"))
374
+ .then((result) => {
375
+ if (!result || result.isEmpty) {
376
+ throw new Error("Return default config.");
377
+ }
378
+ const config = result.config;
379
+ if (typeof config === "object" &&
380
+ config !== null &&
381
+ Object.keys(config).length <= 2) {
382
+ if (Object.keys(config).length === 2 &&
383
+ "importers" in config &&
384
+ "loadPaths" in config) {
385
+ return config;
386
+ }
387
+ if (Object.keys(config).length === 1 &&
388
+ ("importers" in config || "loadPaths" in config)) {
389
+ return config;
390
+ }
391
+ }
392
+ throw new Error("Return default config.");
393
+ })
394
+ .catch(() => {
395
+ const defaultConfig = {
396
+ importers: [
397
+ {
398
+ findFileUrl(url) {
399
+ if (!url.startsWith("sitecss:"))
400
+ return null;
401
+ const pathname = url.substring(8);
402
+ return pathToFileURL(`${resolvePath(srcFolder, "../css")}${pathname.startsWith("/") ? pathname : `/${pathname}`}`);
403
+ },
404
+ },
405
+ {
406
+ findFileUrl(url) {
407
+ if (!url.startsWith("launchpad:"))
408
+ return null;
409
+ const pathname = url.substring(10);
410
+ return pathToFileURL(`${resolvePath(process.cwd(), "public/wp-content/themes/launchpad/src/styles")}${pathname.startsWith("/") ? pathname : `/${pathname}`}`);
411
+ },
412
+ },
413
+ ],
414
+ };
415
+ return defaultConfig;
416
+ });
417
+ return config;
418
+ }
package/dist/index.d.ts CHANGED
@@ -1,2 +1,6 @@
1
- export {};
1
+ import type { Options } from "sass";
2
+ export type SCSSAliases = {
3
+ loadPaths?: Options<"async">["loadPaths"];
4
+ importers?: Options<"async">["importers"];
5
+ };
2
6
  //# sourceMappingURL=index.d.ts.map
@@ -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":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,MAAM,MAAM,WAAW,GAAG;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;CAC1C,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1 @@
1
1
  export {};
2
- // export { config } from "./config";
3
- // export { config as default } from "./config";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atomicsmash/compiler",
3
3
  "type": "module",
4
- "version": "1.0.1-beta.1",
4
+ "version": "1.1.0-beta.3",
5
5
  "description": "A universal compiler for all Atomic Smash projects.",
6
6
  "keywords": [
7
7
  "cli",
@@ -46,29 +46,29 @@
46
46
  "lint:types": "tsc"
47
47
  },
48
48
  "dependencies": {
49
- "@wordpress/dependency-extraction-webpack-plugin": "^6.15.0",
49
+ "@wordpress/dependency-extraction-webpack-plugin": "^6.27.0",
50
50
  "browserslist-to-esbuild": "^2.1.1",
51
51
  "copy-webpack-plugin": "^12.0.2",
52
52
  "cosmiconfig": "^9.0.0",
53
- "cssnano": "^7.0.6",
53
+ "cssnano": "^7.1.0",
54
54
  "esbuild-loader": "^4.3.0",
55
- "fast-glob": "^3.3.2",
55
+ "fast-glob": "^3.3.3",
56
56
  "json2php": "^0.0.12",
57
- "postcss": "^8.4.49",
57
+ "postcss": "^8.5.6",
58
58
  "postcss-loader": "^8.1.1",
59
- "postcss-preset-env": "^10.1.5",
60
- "sass": "^1.83.1",
59
+ "postcss-preset-env": "^10.2.4",
60
+ "sass": "^1.89.2",
61
61
  "sass-loader": "^16.0.4",
62
62
  "svg-spritemap-webpack-plugin": "^4.7.0",
63
63
  "tsconfig-paths-webpack-plugin": "^4.2.0",
64
- "tsx": "^4.19.3",
65
- "webpack": "^5.97.1",
66
- "webpack-assets-manifest": "^6.0.2",
64
+ "tsx": "^4.20.3",
65
+ "webpack": "^5.100.2",
66
+ "webpack-assets-manifest": "^6.2.1",
67
67
  "webpack-bundle-analyzer": "^4.10.2",
68
68
  "yargs": "^17.7.2"
69
69
  },
70
70
  "devDependencies": {
71
- "@tailwindcss/postcss": "^4.0.9",
71
+ "@tailwindcss/postcss": "^4.1.11",
72
72
  "@types/svg-spritemap-webpack-plugin": "^4.4.4",
73
73
  "@types/webpack": "^5.28.5",
74
74
  "@types/webpack-assets-manifest": "^5.1.4",