@atomicsmash/compiler 0.2.4 → 0.3.0

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.
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAoBA,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
@@ -42,16 +42,24 @@ const MODE = process.env.NODE_ENV === "development" || process.env.NODE_ENV ===
42
42
  : "production";
43
43
  const srcFolder = resolvePath(argv.in);
44
44
  const distFolder = resolvePath(argv.out);
45
- // @ts-expect-error -- Module doesn't need to be installed in compiler package.
45
+ // Add optional support for Tailwind if tailwind postcss plugin is installed
46
46
  const tailwindPostCSSPlugin = await import("@tailwindcss/postcss")
47
- .then((tailwindPostCSS) => [
48
- tailwindPostCSS.default,
49
- ])
50
- .catch(async () =>
51
- // @ts-expect-error -- Module doesn't need to be installed in compiler package.
52
- await import("tailwindcss")
47
+ .then((tailwindPostCSS) => [tailwindPostCSS.default])
48
+ .catch(async () => await import("tailwindcss")
53
49
  .then((tailwindcss) => [tailwindcss.default])
54
50
  .catch(() => []));
51
+ // Add optional support for Vue if vue-loader is installed
52
+ const vueConfig = await import("vue-loader")
53
+ .then((vueLoaderModule) => ({
54
+ loader: [
55
+ {
56
+ test: /\.vue$/,
57
+ loader: "vue-loader",
58
+ },
59
+ ],
60
+ plugin: [new vueLoaderModule.VueLoaderPlugin()],
61
+ }))
62
+ .catch(() => ({ loader: [], plugin: [] }));
55
63
  const postCSSConfig = [
56
64
  [
57
65
  ...tailwindPostCSSPlugin,
@@ -107,6 +115,7 @@ const compiler = webpack({
107
115
  },
108
116
  module: {
109
117
  rules: [
118
+ ...vueConfig.loader,
110
119
  {
111
120
  test: /\.[jt]sx?$/,
112
121
  use: {
@@ -115,7 +124,12 @@ const compiler = webpack({
115
124
  presets: ["@babel/preset-typescript", "@babel/preset-env"],
116
125
  },
117
126
  },
118
- exclude: /node_modules/,
127
+ exclude: (file) => {
128
+ if (vueConfig.loader.length > 0) {
129
+ return file.includes("node_modules") && !file.includes(".vue.js");
130
+ }
131
+ return file.includes("node_modules");
132
+ },
119
133
  },
120
134
  {
121
135
  test: /\.s[ac]ss$/i,
@@ -214,6 +228,7 @@ const compiler = webpack({
214
228
  new DependencyExtractionWebpackPlugin({
215
229
  combineAssets: true,
216
230
  }),
231
+ ...vueConfig.plugin,
217
232
  ],
218
233
  });
219
234
  if (argv.watch) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atomicsmash/compiler",
3
3
  "type": "module",
4
- "version": "0.2.4",
4
+ "version": "0.3.0",
5
5
  "description": "A universal compiler for all Atomic Smash projects.",
6
6
  "keywords": [
7
7
  "cli",
@@ -66,10 +66,13 @@
66
66
  "yargs": "^17.7.2"
67
67
  },
68
68
  "devDependencies": {
69
+ "@tailwindcss/postcss": "^4.0.9",
69
70
  "@types/svg-spritemap-webpack-plugin": "^4.4.4",
70
71
  "@types/webpack": "^5.28.5",
71
72
  "@types/webpack-assets-manifest": "^5.1.4",
72
73
  "@types/webpack-bundle-analyzer": "^4.7.0",
73
- "@types/yargs": "^17.0.33"
74
+ "@types/yargs": "^17.0.33",
75
+ "tailwindcss": "^4.0.9",
76
+ "vue-loader": "^17.4.2"
74
77
  }
75
78
  }