@xarc/app-dev 11.0.10 → 12.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xarc/app-dev",
3
- "version": "11.0.10",
3
+ "version": "12.1.0",
4
4
  "description": "Electrode X application development support",
5
5
  "main": "lib/index.js",
6
6
  "homepage": "http://www.electrode.io",
@@ -28,13 +28,13 @@
28
28
  "Joel Chen <xchen@walmartlabs.com>"
29
29
  ],
30
30
  "peerDependencies": {
31
- "@xarc/app": "^11.0.10"
31
+ "@xarc/app": "^12.1.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/cli": "^7.17.10",
35
35
  "@babel/core": "^7.17.12",
36
- "@babel/plugin-transform-class-properties": "^7.24.1",
37
36
  "@babel/plugin-proposal-decorators": "^7.17.12",
37
+ "@babel/plugin-transform-class-properties": "^7.24.1",
38
38
  "@babel/plugin-transform-object-rest-spread": "^7.24.7",
39
39
  "@babel/plugin-transform-react-constant-elements": "^7.17.12",
40
40
  "@babel/plugin-transform-react-inline-elements": "^7.16.7",
@@ -47,11 +47,10 @@
47
47
  "@xarc/dev-base": "^0.1.3",
48
48
  "@xarc/run": "^1.0.5",
49
49
  "@xarc/subapp": "^0.4.2",
50
- "@xarc/webpack": "^11.2.7",
50
+ "@xarc/webpack": "^12.0.0",
51
51
  "ansi-to-html": "^0.7.2",
52
52
  "babel-plugin-lodash": "^3.3.4",
53
53
  "babel-plugin-minify-dead-code-elimination": "^0.5.2",
54
- "babel-plugin-react-css-modules": "^5.2.6",
55
54
  "babel-plugin-transform-node-env-inline": "^0.4.3",
56
55
  "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
57
56
  "boxen": "^5.0.0",
@@ -93,6 +92,8 @@
93
92
  "xsh": "^0.4.5"
94
93
  },
95
94
  "devDependencies": {
95
+ "@babel/core": "^7.11.0",
96
+ "@babel/eslint-parser": "^7.25.1",
96
97
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
97
98
  "@types/chai": "^4.3.1",
98
99
  "@types/mocha": "^10.0.1",
@@ -102,11 +103,9 @@
102
103
  "@types/webpack": "5.28.0",
103
104
  "@typescript-eslint/eslint-plugin": "^5.0.0",
104
105
  "@typescript-eslint/parser": "^5.0.0",
105
- "@xarc/app": "^11.0.10",
106
+ "@xarc/app": "^12.1.0",
106
107
  "@xarc/module-dev": "^4.1.0",
107
108
  "@xarc/run": "^1.1.1",
108
- "@babel/eslint-parser": "^7.25.1",
109
- "@babel/core": "^7.11.0",
110
109
  "chai": "^4.3.6",
111
110
  "electrode-server": "^3.3.0",
112
111
  "electrode-server1": "npm:electrode-server@^1.0.0",
@@ -79,7 +79,6 @@ const basePlugins = [
79
79
 
80
80
  const { BABEL_ENV, NODE_ENV, ENABLE_KARMA_COV } = process.env;
81
81
 
82
- const enableCssModule = Boolean(_.get(xOptions, "webpack.cssModuleSupport"));
83
82
  const enableKarmaCov = ENABLE_KARMA_COV === "true";
84
83
  const isProduction = (BABEL_ENV || NODE_ENV) === "production";
85
84
  // const isTest = (BABEL_ENV || NODE_ENV) === "test";
@@ -96,30 +95,7 @@ const plugins = basePlugins.concat(
96
95
  },
97
96
  ],
98
97
  ],
99
- // css module support
100
- enableCssModule && [
101
- [
102
- "babel-plugin-react-css-modules",
103
- {
104
- context: "./src",
105
- generateScopedName: `${
106
- isProduction ? "" : "[name]__[local]___"
107
- }[hash:base64:5]`,
108
- filetypes: {
109
- ".scss": {
110
- syntax: "postcss-scss",
111
- plugins: ["postcss-nested"],
112
- },
113
- ".styl": {
114
- syntax: "sugarss",
115
- },
116
- ".less": {
117
- syntax: "postcss-less",
118
- },
119
- },
120
- },
121
- ],
122
- ],
98
+
123
99
  enableKarmaCov && [
124
100
  getPluginFrom(
125
101
  ["@xarc/opt-karma", "electrode-archetype-opt-karma"],
@@ -8,7 +8,7 @@
8
8
  import ck from "chalker";
9
9
  import { makeOptionalRequire } from "optional-require";
10
10
  import _ from "lodash";
11
- import { getPluginFrom, loadXarcOptions, detectCSSModule } from "./common";
11
+ import { getPluginFrom, loadXarcOptions } from "./common";
12
12
 
13
13
  const optionalRequire = makeOptionalRequire(require);
14
14
 
@@ -36,59 +36,11 @@ const addFlowPlugin = Boolean(enableFlow && optFlow);
36
36
  const { BABEL_ENV, NODE_ENV, XARC_BABEL_TARGET, ENABLE_KARMA_COV } =
37
37
  process.env;
38
38
 
39
- const enableCssModule = detectCSSModule(xOptions);
40
39
  const enableKarmaCov = ENABLE_KARMA_COV === "true";
41
40
  const isProduction = (BABEL_ENV || NODE_ENV) === "production";
42
41
  // const isTest = (BABEL_ENV || NODE_ENV) === "test";
43
42
  const isNodeTarget = XARC_BABEL_TARGET === "node";
44
43
 
45
- /**
46
- * https://www.npmjs.com/package/babel-plugin-react-css-modules
47
- *
48
- * This plugin enhances the CSS module support from css-loader. It adds a new
49
- * prop styleName in addition to the className prop. This also automatically
50
- * make it work for SSR.
51
- *
52
- * Currently, looks like the author has been inactive on maintaining this plugin
53
- * and there's some compatibility issue with css-loader 4.x.
54
- * https://github.com/gajus/babel-plugin-react-css-modules/issues/291
55
- *
56
- * Resolution: TBD
57
- *
58
- * @returns null or settings for babel-plugin-react-css-modules
59
- */
60
- const getReactCssModulePlugin = (): any => {
61
- if (!enableCssModule) {
62
- return null;
63
- }
64
-
65
- const enableShortenCSSNames = xOptions.webpack.enableShortenCSSNames;
66
- const enableShortHash = isProduction && enableShortenCSSNames;
67
- return [
68
- [
69
- "babel-plugin-react-css-modules",
70
- {
71
- context: "./src",
72
- generateScopedName: `${
73
- enableShortHash ? "" : "[name]__[local]___"
74
- }[hash:base64:5]`,
75
- filetypes: {
76
- ".scss": {
77
- syntax: "postcss-scss",
78
- plugins: ["postcss-nested"],
79
- },
80
- ".styl": {
81
- syntax: "sugarss",
82
- },
83
- ".less": {
84
- syntax: "postcss-less",
85
- },
86
- },
87
- },
88
- ],
89
- ];
90
- };
91
-
92
44
  const basePlugins = [
93
45
  // plugin to transpile async/await to Promise
94
46
  // not for node.js because it has native async/await
@@ -157,9 +109,6 @@ const plugins = basePlugins.concat(
157
109
  },
158
110
  ],
159
111
  ],
160
- // css module support
161
- // Note: this is needed for server side (node.js) also.
162
- getReactCssModulePlugin(),
163
112
  !isNodeTarget &&
164
113
  enableKarmaCov && [
165
114
  getPluginFrom(
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ require: ["@xarc/app-dev/config/mocha/setup.js", "@babel/register"],
3
+ reporter: "spec",
4
+ spec: "@(__test__|__tests__|test|tests)/**/*.@(js|jsx|ts|tsx)",
5
+ recursive: true,
6
+ ui: "bdd",
7
+ };
@@ -1,14 +1,22 @@
1
1
  import { makeOptionalRequire } from "optional-require";
2
2
  const optionalRequire = makeOptionalRequire(require);
3
-
4
3
  const Enzyme = optionalRequire("enzyme");
5
4
  const Adapter = optionalRequire("enzyme-adapter-react-16");
6
5
 
6
+ const jsDomGlobal = optionalRequire("jsdom-global");
7
+ const tsNode = optionalRequire("ts-node");
8
+
7
9
  if (Enzyme && Adapter) {
8
10
  Enzyme.configure({ adapter: new Adapter() });
9
11
  }
12
+ if (jsDomGlobal) {
13
+ require("jsdom-global/register");
14
+ }
10
15
 
11
- const chai = optionalRequire("chai");
16
+ if (tsNode) {
17
+ require("ts-node/register");
18
+ }
19
+ const chai = optionalRequire("chai").default;
12
20
 
13
21
  /**
14
22
  * @param addons