@dtwo/webpack-builder 3.0.0-rc.14 → 3.1.0-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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 - Dtwo Project
3
+ Copyright (c) 2022 - Dtwo Team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
- # Dtwo Webpack Builder
1
+ # Dtwo
2
2
 
3
- > The [Webpack](https://webpack.js.org) bundler for Dtwo 3
3
+ Dtwo 3: **The Intuitive Web Framework** ✨
4
+
5
+ ## License
6
+
7
+ [MIT](./LICENSE)
package/dist/index.mjs CHANGED
@@ -308,6 +308,7 @@ function basePlugins(ctx) {
308
308
  clearConsole: false,
309
309
  reporter: "consola",
310
310
  logLevel: "ERROR"
311
+ // TODO
311
312
  })
312
313
  );
313
314
  }
@@ -323,11 +324,13 @@ function basePlugins(ctx) {
323
324
  reporters: ["stats"],
324
325
  stats: !ctx.isDev,
325
326
  reporter: {
327
+ // @ts-ignore
326
328
  change: (_, { shortPath }) => {
327
329
  if (!ctx.isServer) {
328
330
  dtwo.callHook("webpack:change", shortPath);
329
331
  }
330
332
  },
333
+ // @ts-ignore
331
334
  done: ({ state }) => {
332
335
  if (state.hasErrors) {
333
336
  dtwo.callHook("webpack:error");
@@ -338,6 +341,7 @@ function basePlugins(ctx) {
338
341
  allDone: () => {
339
342
  dtwo.callHook("webpack:done");
340
343
  },
344
+ // @ts-ignore
341
345
  progress({ statesArray }) {
342
346
  dtwo.callHook("webpack:progress", statesArray);
343
347
  }
@@ -377,12 +381,16 @@ function baseTranspile(ctx) {
377
381
  const { options } = ctx;
378
382
  const transpile = [
379
383
  /\.kdu\.js/i,
384
+ // include SFCs in node_modules
380
385
  /consola\/src/,
381
386
  /kdu-demi/
382
387
  ];
383
388
  for (let pattern of options.build.transpile) {
384
389
  if (typeof pattern === "function") {
385
- pattern = pattern(ctx);
390
+ const result = pattern(ctx);
391
+ if (result) {
392
+ pattern = result;
393
+ }
386
394
  }
387
395
  if (typeof pattern === "string") {
388
396
  transpile.push(new RegExp(escapeRegExp(normalize(pattern))));
@@ -410,6 +418,7 @@ function getOutput(ctx) {
410
418
  function getWarningIgnoreFilter(ctx) {
411
419
  const { options } = ctx;
412
420
  const filters = [
421
+ // Hide warnings about plugins without a default export (#1179)
413
422
  (warn) => warn.name === "ModuleDependencyWarning" && warn.message.includes("export 'default'") && warn.message.includes("dtwo_plugin_"),
414
423
  ...options.webpack.warningIgnoreFilters || []
415
424
  ];
@@ -508,7 +517,9 @@ class KduSSRClientPlugin {
508
517
  all: allFiles,
509
518
  initial: initialFiles,
510
519
  async: asyncFiles,
511
- modules: {},
520
+ modules: {
521
+ /* [identifier: string]: Array<index: number> */
522
+ },
512
523
  assetsMapping
513
524
  };
514
525
  const { entrypoints = {}, namedChunkGroups = {} } = stats;
@@ -545,7 +556,7 @@ class KduSSRClientPlugin {
545
556
  }
546
557
  assetModules.forEach((m2) => {
547
558
  if (m2.chunks.includes(cid)) {
548
- files.push.apply(files, m2.assets.map(fileToIndex));
559
+ files.push(...m2.assets.map(fileToIndex));
549
560
  }
550
561
  });
551
562
  }
@@ -704,6 +715,7 @@ const getPostcssConfig = (dtwo) => {
704
715
  return {
705
716
  sourceMap: dtwo.options.webpack.cssSourceMap,
706
717
  plugins: dtwo.options.postcss.plugins,
718
+ // Array, String or Function
707
719
  order: "autoprefixerAndCssnanoLast"
708
720
  };
709
721
  }
@@ -731,15 +743,6 @@ const getPostcssConfig = (dtwo) => {
731
743
  if (!dtwo.options.webpack.postcss || !dtwo.options.postcss) {
732
744
  return false;
733
745
  }
734
- const configFile = dtwo.options.postcss.config;
735
- if (configFile) {
736
- return {
737
- postcssOptions: {
738
- config: configFile
739
- },
740
- sourceMap: dtwo.options.webpack.cssSourceMap
741
- };
742
- }
743
746
  let postcssOptions = cloneDeep(dtwo.options.postcss);
744
747
  if (isPureObject(postcssOptions)) {
745
748
  if (Array.isArray(postcssOptions.plugins)) {
@@ -750,6 +753,7 @@ const getPostcssConfig = (dtwo) => {
750
753
  }
751
754
  delete dtwo.options.webpack.postcss.order;
752
755
  return {
756
+ // @ts-expect-error
753
757
  sourceMap: dtwo.options.webpack.cssSourceMap,
754
758
  ...dtwo.options.webpack.postcss,
755
759
  postcssOptions
@@ -807,10 +811,12 @@ function createdStyleRule(lang, test, processorLoader, ctx) {
807
811
  return {
808
812
  test,
809
813
  oneOf: [
814
+ // This matches <style module>
810
815
  {
811
816
  resourceQuery: /module/,
812
817
  use: cssModuleLoaders.concat(styleLoaders)
813
818
  },
819
+ // This matches plain <style> or <style scoped>
814
820
  {
815
821
  use: cssLoaders.concat(styleLoaders)
816
822
  }
@@ -835,6 +841,10 @@ function createCssLoadersRule(ctx, cssLoaderOptions) {
835
841
  ];
836
842
  }
837
843
  return [
844
+ // {
845
+ // loader: 'kdu-style-loader',
846
+ // options: options.webpack.loaders.kduStyle
847
+ // },
838
848
  cssLoader
839
849
  ];
840
850
  }
@@ -912,6 +922,7 @@ function clientHMR(ctx) {
912
922
  const hotMiddlewareClientOptionsStr = querystring.stringify(hotMiddlewareClientOptions);
913
923
  const app = config.entry.app;
914
924
  app.unshift(
925
+ // https://github.com/glenjamin/webpack-hot-middleware#config
915
926
  `webpack-hot-middleware/client?${hotMiddlewareClientOptionsStr}`
916
927
  );
917
928
  config.plugins = config.plugins || [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dtwo/webpack-builder",
3
- "version": "3.0.0-rc.14",
4
- "repository": "d2js/framework",
3
+ "version": "3.1.0-0",
4
+ "repository": "d2js/dtwo",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "types": "./dist/index.d.ts",
@@ -13,56 +13,56 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@babel/core": "^7.20.2",
17
- "@d2js/friendly-errors-webpack-plugin": "^2.5.2",
18
- "@dtwo/kit": "3.0.0-rc.14",
19
- "@dtwo/unplugin": "^1.0.0",
20
- "autoprefixer": "^10.4.13",
21
- "css-loader": "^6.7.2",
22
- "css-minimizer-webpack-plugin": "^4.2.2",
23
- "cssnano": "^5.1.14",
24
- "esbuild-loader": "^2.20.0",
25
- "escape-string-regexp": "^5.0.0",
26
- "estree-walker": "^3.0.1",
27
- "file-loader": "^6.2.0",
28
- "fork-ts-checker-webpack-plugin": "^7.2.13",
29
- "fs-extra": "^10.1.0",
30
- "hash-sum": "^2.0.0",
31
- "kdu-bundle-renderer": "^1.0.0",
32
- "kdu-loader": "^17.0.0",
33
- "lodash-es": "^4.17.21",
34
- "magic-string": "^0.26.7",
35
- "memfs": "^3.4.11",
36
- "mini-css-extract-plugin": "^2.6.1",
37
- "mlly": "^1.0.0",
38
- "ohash": "^1.0.0",
39
- "pathe": "^1.0.0",
40
- "pify": "^6.1.0",
41
- "postcss": "^8.4.19",
42
- "postcss-import": "^15.0.0",
43
- "postcss-loader": "^7.0.1",
44
- "postcss-url": "^10.1.3",
45
- "style-resources-loader": "^1.5.0",
46
- "time-fix-plugin": "^2.0.7",
47
- "ufo": "^1.0.0",
48
- "url-loader": "^4.1.1",
49
- "webpack": "^5.75.0",
50
- "webpack-bundle-analyzer": "^4.7.0",
51
- "webpack-dev-middleware": "^5.3.3",
52
- "webpack-hot-middleware": "^2.25.3",
53
- "webpack-virtual-modules": "^0.4.6",
54
- "webpackbar": "^5.0.2"
16
+ "@babel/core": "7.20.12",
17
+ "@d2js/friendly-errors-webpack-plugin": "2.5.2",
18
+ "@dtwo/kit": "3.1.0-0",
19
+ "@dtwo/unplugin": "1.0.0",
20
+ "autoprefixer": "10.4.13",
21
+ "css-loader": "6.7.3",
22
+ "css-minimizer-webpack-plugin": "4.2.2",
23
+ "cssnano": "5.1.14",
24
+ "esbuild-loader": "2.21.0",
25
+ "escape-string-regexp": "5.0.0",
26
+ "estree-walker": "3.0.3",
27
+ "file-loader": "6.2.0",
28
+ "fork-ts-checker-webpack-plugin": "7.3.0",
29
+ "fs-extra": "11.1.0",
30
+ "hash-sum": "2.0.0",
31
+ "kdu-bundle-renderer": "1.0.0",
32
+ "kdu-loader": "17.0.0",
33
+ "lodash-es": "4.17.21",
34
+ "magic-string": "0.27.0",
35
+ "memfs": "3.4.13",
36
+ "mini-css-extract-plugin": "2.7.2",
37
+ "mlly": "1.1.0",
38
+ "ohash": "1.0.0",
39
+ "pathe": "1.0.0",
40
+ "pify": "6.1.0",
41
+ "postcss": "8.4.21",
42
+ "postcss-import": "15.1.0",
43
+ "postcss-loader": "7.0.2",
44
+ "postcss-url": "10.1.3",
45
+ "style-resources-loader": "1.5.0",
46
+ "time-fix-plugin": "2.0.7",
47
+ "ufo": "1.0.1",
48
+ "url-loader": "4.1.1",
49
+ "webpack": "5.75.0",
50
+ "webpack-bundle-analyzer": "4.7.0",
51
+ "webpack-dev-middleware": "6.0.1",
52
+ "webpack-hot-middleware": "2.25.3",
53
+ "webpack-virtual-modules": "0.5.0",
54
+ "webpackbar": "5.0.2"
55
55
  },
56
56
  "devDependencies": {
57
- "@dtwo/schema": "3.0.0-rc.14",
58
- "@types/lodash-es": "^4.17.6",
59
- "@types/pify": "^5.0.1",
60
- "@types/webpack-bundle-analyzer": "^4.6.0",
61
- "@types/webpack-dev-middleware": "^5.0.2",
62
- "@types/webpack-hot-middleware": "^2.25.6",
63
- "@types/webpack-virtual-modules": "^0",
57
+ "@dtwo/schema": "3.1.0-0",
58
+ "@types/lodash-es": "4.17.6",
59
+ "@types/pify": "5.0.1",
60
+ "@types/webpack-bundle-analyzer": "4.6.0",
61
+ "@types/webpack-dev-middleware": "5.3.0",
62
+ "@types/webpack-hot-middleware": "2.25.6",
63
+ "@types/webpack-virtual-modules": "0.1.1",
64
64
  "kdu": "3.2.45",
65
- "unbuild": "latest"
65
+ "unbuild": "1.1.1"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "kdu": "^3.2.45"