@fmsim/builder 1.0.87 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fmsim/builder",
3
- "version": "1.0.87",
3
+ "version": "2.0.0-beta.3",
4
4
  "description": "Layout View 어플리케이션 빌드를 위해 구성된 모듈입니다.",
5
5
  "main": "index.js",
6
6
  "author": "Hearty Oh <heartyoh@hatiolab.com>",
@@ -83,5 +83,5 @@
83
83
  "webpack-dev-server": "^5.2.0",
84
84
  "workbox-webpack-plugin": "^7.0.0"
85
85
  },
86
- "gitHead": "7e31b28df73b15ade27ee6d8c97ba94d7dc4eff4"
86
+ "gitHead": "29cf1d4f43eb48dc030aaeb188f2dce65ecff95f"
87
87
  }
@@ -20,9 +20,9 @@ class ThemeOverridePlugin {
20
20
  compiler.hooks.entryOption.tap({ name: 'ThemeOverridePlugin' }, (context, entry) => {
21
21
  var appname = AppPackage.name
22
22
 
23
- var { chunk = 'theme', themeFolder = path.join('client', 'themes') } = this.options
23
+ var { chunk = 'theme', themeFolder = 'themes' } = this.options
24
24
 
25
- var reversedModuleNames = [...orderedModuleNames, appname].reverse()
25
+ var reversedModuleNames = [...orderedModuleNames].reverse()
26
26
  var themeFiles = {}
27
27
 
28
28
  /* 최상위 모듈부터 복사한다. 하위 모듈에서는 중복 여부에 따라 복사여부를 결정한다. */
@@ -32,18 +32,22 @@ class ThemeOverridePlugin {
32
32
  } else {
33
33
  var modulePath = path.dirname(require.resolve(`${m}/package.json`))
34
34
  }
35
+ var packageJson = require(path.join(modulePath, 'package.json'))
36
+ var browser = packageJson.browser
35
37
 
36
- var sourcePath = path.join(modulePath, themeFolder)
38
+ if (browser) {
39
+ var sourcePath = path.dirname(path.join(modulePath, browser))
37
40
 
38
- var files = glob.sync(path.join(sourcePath, '*.?(sass|scss|css)'))
41
+ var files = glob.sync(path.join(sourcePath, themeFolder, '*.?(sass|scss|css)'))
39
42
 
40
- files.forEach(filepath => {
41
- let filename = path.basename(filepath)
43
+ files.forEach(filepath => {
44
+ let filename = path.basename(filepath)
42
45
 
43
- if (!themeFiles[filename]) {
44
- themeFiles[filename] = filepath
45
- }
46
- })
46
+ if (!themeFiles[filename]) {
47
+ themeFiles[filename] = filepath
48
+ }
49
+ })
50
+ }
47
51
  })
48
52
 
49
53
  entry[chunk] = {
@@ -1,3 +1,8 @@
1
+ process.on('uncaughtException', error => {
2
+ console.error('Uncaught Exception:', error.stack)
3
+ process.exit(1)
4
+ })
5
+
1
6
  const path = require('path')
2
7
  const fs = require('fs')
3
8
  const webpack = require('webpack')
@@ -5,7 +10,6 @@ const HTMLWebpackPlugin = require('html-webpack-plugin')
5
10
  const CopyWebpackPlugin = require('copy-webpack-plugin')
6
11
  const I18nBundlerPlugin = require('./webpack-plugins/i18n-bundler-plugin')
7
12
  const FolderOverridePlugin = require('./webpack-plugins/folder-override-plugin')
8
- const WorkboxWebpackPlugin = require('workbox-webpack-plugin')
9
13
  const MiniCssExtractPlugin = require('mini-css-extract-plugin')
10
14
  const ThemeOverridePlugin = require('./webpack-plugins/theme-override-plugin')
11
15
  const EntryBuilder = require('./controller/entries-builder')
@@ -65,12 +69,7 @@ try {
65
69
  }
66
70
 
67
71
  let entries = Object.assign({}, EntryBuilder(), {
68
- main: [
69
- path.resolve(ShellModulePath, 'client', 'index.js'),
70
- '@hatiolab/webpack-hot-client/client?path=/__webpack_hmr&timeout=20000&reload=true'
71
- ],
72
- 'headless-scene-components': [path.resolve(ShellModulePath, '.', 'client', 'scene', 'scene-components.js')],
73
- 'scene-viewer': [path.resolve(ShellModulePath, '.', 'client', 'scene', 'scene-viewer.js')]
72
+ main: [path.resolve(ShellModulePath, 'client', 'index.ts')]
74
73
  })
75
74
 
76
75
  module.exports = {
@@ -83,17 +82,15 @@ module.exports = {
83
82
  AppPackage.name == '@hatiolab/things-scene' ? path.resolve(appRootPath, 'src', 'index.js') : appRootPath
84
83
  },
85
84
  extensions: ['.ts', '.js', '.jsx', '.tsx', '.json'],
85
+ extensionAlias: {
86
+ '.js': ['.ts', '.js']
87
+ },
86
88
  modules: [NodeModulePath]
87
89
  },
88
90
  resolveLoader: {
89
91
  modules: [path.resolve(BuilderModulePath, 'web-loaders'), NodeModulePath]
90
92
  },
91
- externals:
92
- AppPackage.name == '@hatiolab/things-scene'
93
- ? {}
94
- : {
95
- '@hatiolab/things-scene': 'scene'
96
- },
93
+ externals: {},
97
94
  output: {
98
95
  path: OUTPUT_PATH,
99
96
  filename: 'fmsim/[name].js',
@@ -187,20 +184,16 @@ module.exports = {
187
184
  plugins: [
188
185
  new ThemeOverridePlugin({
189
186
  chunk: 'theme',
190
- themeFolder: path.join('client', 'themes')
187
+ themeFolder: 'themes'
191
188
  }),
192
189
  new HTMLWebpackPlugin({
193
190
  template: TemplatePath,
194
- /*
195
- Allows to control how chunks should be sorted before they are included to the HTML.
196
- Allowed values are 'none' | 'auto' | 'dependency' | 'manual' | {Function}
197
- */
198
191
  chunksSortMode: 'none',
199
192
  chunks: ['main', 'theme']
200
193
  }),
201
194
  new MiniCssExtractPlugin({
202
195
  filename: '[name].css',
203
- chunkFilename: '[name].[hash].css',
196
+ chunkFilename: '[name].[chunkhash].css',
204
197
  ignoreOrder: false
205
198
  }),
206
199
  new CopyWebpackPlugin({
@@ -210,33 +203,24 @@ module.exports = {
210
203
  to: OUTPUT_PATH + '/fmsim',
211
204
  context: NodeModuleParentPath
212
205
  },
213
- {
214
- from: 'node_modules/@material-design-icons/font/*',
215
- to: OUTPUT_PATH + '/fmsim',
216
- context: NodeModuleParentPath
217
- },
218
206
  {
219
207
  from: 'node_modules/@fontsource/roboto/**/*',
220
208
  to: OUTPUT_PATH + '/fmsim',
221
209
  context: NodeModuleParentPath
222
210
  },
223
211
  {
224
- from: 'node_modules/pretendard/**/*',
212
+ from: 'node_modules/@webcomponents/**/*',
225
213
  to: OUTPUT_PATH + '/fmsim',
226
214
  context: NodeModuleParentPath
227
215
  },
228
216
  {
229
- from: 'node_modules/@webcomponents/webcomponentsjs/*',
230
- to: OUTPUT_PATH + '/fmsim',
231
- context: NodeModuleParentPath
232
- },
233
- {
234
- from: 'node_modules/web-animations-js/web-animations-next.min.js*',
217
+ from: 'node_modules/@hatiolab/things-scene/*.js*',
235
218
  to: OUTPUT_PATH + '/fmsim',
219
+ noErrorOnMissing: true,
236
220
  context: NodeModuleParentPath
237
221
  },
238
222
  {
239
- from: 'node_modules/@hatiolab/things-scene/*.js*',
223
+ from: 'node_modules/three/**/*',
240
224
  to: OUTPUT_PATH + '/fmsim',
241
225
  noErrorOnMissing: true,
242
226
  context: NodeModuleParentPath
@@ -261,12 +245,6 @@ module.exports = {
261
245
  new I18nBundlerPlugin({
262
246
  output: 'translations'
263
247
  }),
264
- new WorkboxWebpackPlugin.InjectManifest({
265
- swSrc: path.resolve(ShellModulePath, 'client/serviceworker/sw-src.js'),
266
- swDest: 'service-worker.js',
267
- maximumFileSizeToCacheInBytes: 50000000,
268
- exclude: [/^helps\//, /headless/, /openapi/] // exclude help files, headless files
269
- }),
270
248
  new webpack.DefinePlugin({
271
249
  'process.env': {
272
250
  'NODE-ENV': JSON.stringify('development'),
@@ -278,7 +256,11 @@ module.exports = {
278
256
  'APP-DESCRIPTION': JSON.stringify(AppPackage.description),
279
257
  'APP-TAGLINE': JSON.stringify(AppPackage.tagline)
280
258
  }
281
- })
259
+ }),
260
+ new NodePolyfillPlugin()
282
261
  ],
283
- devtool: 'source-map'
262
+ devtool: 'source-map',
263
+ watchOptions: {
264
+ ignored: /node_modules\/(?!@hatiolab|@operato|@things-factory)/
265
+ }
284
266
  }
package/webpack.config.js CHANGED
@@ -67,9 +67,7 @@ try {
67
67
  debug('Index.html TemplatePath', TemplatePath)
68
68
 
69
69
  let entries = Object.assign({}, EntryBuilder(), {
70
- main: path.resolve(ShellModulePath, 'client', 'index.js'),
71
- 'headless-scene-components': [path.resolve(ShellModulePath, '.', 'client', 'scene', 'scene-components.js')],
72
- 'scene-viewer': [path.resolve(ShellModulePath, '.', 'client', 'scene', 'scene-viewer.js')]
70
+ main: path.resolve(ShellModulePath, 'client', 'index.ts')
73
71
  })
74
72
 
75
73
  module.exports = {
@@ -79,20 +77,19 @@ module.exports = {
79
77
  aliasFields: ['browser'],
80
78
  alias: {
81
79
  [AppPackage.name]:
82
- AppPackage.name == '@hatiolab/things-scene' ? path.resolve(appRootPath, 'src', 'index.js') : appRootPath
80
+ AppPackage.name == '@hatiolab/things-scene' ? path.resolve(appRootPath, 'dist', 'index.js') : appRootPath
83
81
  },
84
82
  extensions: ['.ts', '.js', '.jsx', '.tsx', '.json'],
83
+ extensionAlias: {
84
+ '.js': ['.ts', '.js'],
85
+ '.jsx': ['.tsx', '.jsx']
86
+ },
85
87
  modules: [NodeModulePath]
86
88
  },
87
89
  resolveLoader: {
88
90
  modules: [path.resolve(BuilderModulePath, 'web-loaders'), NodeModulePath]
89
91
  },
90
- externals:
91
- AppPackage.name == '@hatiolab/things-scene'
92
- ? {}
93
- : {
94
- '@hatiolab/things-scene': 'scene'
95
- },
92
+ externals: {},
96
93
  output: {
97
94
  path: OUTPUT_PATH,
98
95
  filename: 'fmsim/[name].js',
@@ -210,6 +207,7 @@ module.exports = {
210
207
  {
211
208
  from: 'node_modules/@material-design-icons/font/*',
212
209
  to: OUTPUT_PATH + '/fmsim',
210
+ noErrorOnMissing: true,
213
211
  context: NodeModuleParentPath
214
212
  },
215
213
  {
@@ -230,6 +228,7 @@ module.exports = {
230
228
  {
231
229
  from: 'node_modules/web-animations-js/web-animations-next.min.js*',
232
230
  to: OUTPUT_PATH + '/fmsim',
231
+ noErrorOnMissing: true,
233
232
  context: NodeModuleParentPath
234
233
  },
235
234
  {