@xh/hoist-dev-utils 6.0.0-SNAPSHOT.1666758175881 → 6.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.
Files changed (2) hide show
  1. package/configureWebpack.js +11 -6
  2. package/package.json +17 -16
@@ -301,10 +301,10 @@ async function configureWebpack(env) {
301
301
  const appDirPath = path.resolve(srcPath, 'apps'),
302
302
  apps = fs
303
303
  .readdirSync(appDirPath)
304
- .filter(f => f.endsWith('.js'))
304
+ .filter(f => f.endsWith('.js') || f.endsWith('.ts'))
305
305
  .map(f => {
306
306
  return {
307
- name: f.replace('.js', ''),
307
+ name: f.replace('.js', '').replace('.ts', ''),
308
308
  path: path.resolve(appDirPath, f)
309
309
  };
310
310
  }),
@@ -374,7 +374,7 @@ async function configureWebpack(env) {
374
374
  // Add JSX to support imports from .jsx source w/o needing to add the extension.
375
375
  // Include "*" to continue supporting other imports that *do* specify an extension
376
376
  // within the import statement (i.e. `import './foo.png'`). Yes, it's confusing.
377
- extensions: ['*', '.js', '.jsx', '.json']
377
+ extensions: ['*', '.js', '.ts', '.jsx', '.tsx', '.json']
378
378
  },
379
379
 
380
380
  // Ensure Webpack can find loaders installed both within the top-level node_modules dir for
@@ -424,15 +424,16 @@ async function configureWebpack(env) {
424
424
  },
425
425
 
426
426
  //------------------------
427
- // JS processing
427
+ // JS/TS processing
428
428
  // Transpile via Babel, with presets/plugins to support Hoist's use of modern / staged JS features.
429
429
  //------------------------
430
430
  {
431
- test: /\.(jsx?)$/,
431
+ test: /\.(jsx?)$|\.(tsx?)$/,
432
432
  use: {
433
433
  loader: 'babel-loader',
434
434
  options: {
435
435
  presets: [
436
+ '@babel/preset-typescript',
436
437
  '@babel/preset-react',
437
438
  [
438
439
  '@babel/preset-env',
@@ -456,6 +457,11 @@ async function configureWebpack(env) {
456
457
  ]
457
458
  ],
458
459
  plugins: [
460
+ // Support Typescript via Babel. `isTSX` option allows use of JSX inline with
461
+ // .js files for older JS apps. Typescript apps must use the .tsx extension for
462
+ // any files containing JSX syntax.
463
+ ['@babel/plugin-transform-typescript', {allowDeclareFields: true, isTSX: true}],
464
+
459
465
  // Support our current decorator syntax, for MobX and Hoist decorators.
460
466
  // See notes @ https://babeljs.io/docs/en/babel-plugin-proposal-decorators#legacy
461
467
  ['@babel/plugin-proposal-decorators', {legacy: true}],
@@ -702,7 +708,6 @@ async function configureWebpack(env) {
702
708
  };
703
709
  }
704
710
 
705
-
706
711
  //------------------------
707
712
  // Implementation
708
713
  //------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist-dev-utils",
3
- "version": "6.0.0-SNAPSHOT.1666758175881",
3
+ "version": "6.1.0",
4
4
  "description": "Utilities for configuring builds of Hoist-React client applications.",
5
5
  "repository": "github:xh/hoist-dev-utils",
6
6
  "homepage": "https://github.com/xh/hoist-dev-utils",
@@ -11,16 +11,17 @@
11
11
  "configureWebpack.js"
12
12
  ],
13
13
  "dependencies": {
14
- "@babel/core": "~7.18.9",
15
- "@babel/plugin-proposal-decorators": "~7.18.9",
16
- "@babel/preset-env": "~7.18.9",
17
- "@babel/preset-react": "~7.18.6",
14
+ "@babel/core": "^7.20",
15
+ "@babel/plugin-proposal-decorators": "^7.20",
16
+ "@babel/preset-env": "^7.20",
17
+ "@babel/preset-react": "^7.18",
18
+ "@babel/preset-typescript": "^7.18",
18
19
  "@cerner/duplicate-package-checker-webpack-plugin": "~2.3.0",
19
20
  "@types/lodash": "^4.0.0",
20
- "@types/react": "^17.0.0",
21
- "@xh/eslint-config": "~4.0.1",
22
- "autoprefixer": "~10.4.7",
23
- "babel-loader": "~8.2.5",
21
+ "@types/react": "^18.0.0",
22
+ "@xh/eslint-config": "^5.0.0",
23
+ "autoprefixer": "~10.4.13",
24
+ "babel-loader": "~9.1.0",
24
25
  "babel-plugin-transform-imports": "~2.0.0",
25
26
  "case-sensitive-paths-webpack-plugin": "~2.4.0",
26
27
  "changelog-parser": "~2.8.1",
@@ -31,21 +32,21 @@
31
32
  "html-webpack-plugin": "~5.5.0",
32
33
  "html-webpack-tags-plugin": "~3.0.2",
33
34
  "lodash": "~4.17.21",
34
- "mini-css-extract-plugin": "~2.6.1",
35
+ "mini-css-extract-plugin": "~2.7.0",
35
36
  "postcss": "~8.4.14",
36
37
  "postcss-flexbugs-fixes": "~5.0.2",
37
38
  "postcss-loader": "~7.0.1",
38
39
  "rimraf": "~3.0.2",
39
- "sass": "~1.53.0",
40
- "sass-loader": "~13.0.2",
40
+ "sass": "~1.56.1",
41
+ "sass-loader": "~13.2.0",
41
42
  "sass-material-colors": "~0.0.5",
42
43
  "style-loader": "~3.3.1",
43
44
  "terser-webpack-plugin": "~5.3.3",
44
45
  "url-loader": "~4.1.1",
45
- "webpack": "~5.73.0",
46
- "webpack-bundle-analyzer": "~4.5.0",
47
- "webpack-cli": "~4.10.0",
48
- "webpack-dev-server": "~4.9.3",
46
+ "webpack": "~5.75.0",
47
+ "webpack-bundle-analyzer": "~4.7.0",
48
+ "webpack-cli": "~5.0.0",
49
+ "webpack-dev-server": "~4.11.1",
49
50
  "webpackbar": "~5.0.2"
50
51
  }
51
52
  }