@eclipse-scout/cli 22.0.41 → 23.1.1

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,41 +1,50 @@
1
1
  /*
2
- * Copyright (c) 2014-2019 BSI Business Systems Integration AG.
3
- * All rights reserved. This program and the accompanying materials
4
- * are made available under the terms of the Eclipse Public License v1.0
5
- * which accompanies this distribution, and is available at
6
- * http://www.eclipse.org/legal/epl-v10.html
2
+ * Copyright (c) 2010, 2023 BSI Business Systems Integration AG
7
3
  *
8
- * Contributors:
9
- * BSI Business Systems Integration AG - initial API and implementation
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
10
9
  */
11
10
 
12
11
  const fs = require('fs');
13
12
  const path = require('path');
14
13
  const themeJsOutFilter = f => /.*theme.*\.js/.test(f);
15
- const listFiles = require('./list-files');
14
+ const {listFiles} = require('./files');
15
+ const scoutBuild = require('./constants');
16
16
 
17
17
  function deleteFile(filename) {
18
- fs.access(filename, fs.constants.W_OK, err => {
19
- if (err) {
20
- console.error(`${filename} does not exist or cannot be deleted.`);
21
- } else {
22
- fs.unlink(filename, unlinkErr => {
23
- if (unlinkErr) {
24
- throw unlinkErr;
25
- }
26
- });
18
+ if (!fs.existsSync(filename)) {
19
+ return;
20
+ }
21
+ try {
22
+ fs.accessSync(filename, fs.constants.W_OK);
23
+ } catch (err) {
24
+ console.error(`No right to delete ${filename}.`, err);
25
+ return;
26
+ }
27
+ fs.unlink(filename, unlinkErr => {
28
+ if (unlinkErr) {
29
+ throw unlinkErr;
27
30
  }
28
31
  });
29
32
  }
30
33
 
34
+ function fileListFilter(fileName) {
35
+ return fileName !== scoutBuild.fileListName
36
+ && !fileName.endsWith('.LICENSE')
37
+ && !themeJsOutFilter(fileName)
38
+ && !fileName.endsWith('d.ts')
39
+ && !fileName.endsWith('d.ts.map');
40
+ }
41
+
31
42
  module.exports = {
32
43
  createFileList: dir => {
33
44
  const scoutBuild = require('./constants');
34
45
  let content = '';
35
46
  listFiles(dir)
36
- .filter(fileName => fileName !== scoutBuild.fileListName)
37
- .filter(fileName => !fileName.endsWith('.LICENSE'))
38
- .filter(fileName => !themeJsOutFilter(fileName))
47
+ .filter(fileName => fileListFilter(fileName))
39
48
  .map(file => file.substring(dir.length + 1))
40
49
  .map(path => path.replace(/\\/g, '/'))
41
50
  .map(fileName => `${fileName}\n`)
@@ -55,6 +64,5 @@ module.exports = {
55
64
  listFiles(dir)
56
65
  .filter(themeJsOutFilter)
57
66
  .forEach(f => deleteFile(f));
58
-
59
67
  }
60
68
  };
@@ -1,34 +1,37 @@
1
1
  /*
2
- * Copyright (c) 2010-2022 BSI Business Systems Integration AG.
3
- * All rights reserved. This program and the accompanying materials
4
- * are made available under the terms of the Eclipse Public License v1.0
5
- * which accompanies this distribution, and is available at
6
- * https://www.eclipse.org/legal/epl-v10.html
2
+ * Copyright (c) 2010, 2023 BSI Business Systems Integration AG
7
3
  *
8
- * Contributors:
9
- * BSI Business Systems Integration AG - initial API and implementation
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
10
9
  */
10
+ const fs = require('fs');
11
+ const path = require('path');
12
+ const scoutBuildConstants = require('./constants');
11
13
  const CopyPlugin = require('copy-webpack-plugin');
12
14
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
13
15
  const AfterEmitWebpackPlugin = require('./AfterEmitWebpackPlugin');
14
-
15
- const path = require('path');
16
- const scoutBuildConstants = require('./constants');
17
- const webpack = require('webpack');
16
+ const {SourceMapDevToolPlugin, WatchIgnorePlugin, ProgressPlugin} = require('webpack');
18
17
 
19
18
  /**
20
19
  * @param {string} args.mode development or production
21
- * @param {boolean} args.clean true, to clean the dist folder before each build. Default is true.
20
+ * @param {boolean} args.clean true, to clean the dist folder before each build. Default is false.
22
21
  * @param {boolean} args.progress true, to show build progress in percentage. Default is true.
23
22
  * @param {boolean} args.profile true, to show timing information for each build step. Default is false.
23
+ * @param {boolean} args.watch true, if webpack runs in watch mode. Default is false.
24
24
  * @param {[]} args.resDirArray an array containing directories which should be copied to dist/res
25
+ * @param {object} args.tsOptions a config object to be passed to the ts-loader
25
26
  */
26
27
  module.exports = (env, args) => {
27
- const {devMode, outSubDir, cssFilename, jsFilename} = scoutBuildConstants.getConstantsForMode(args.mode);
28
+ const buildMode = args.mode;
29
+ const {devMode, cssFilename, jsFilename} = scoutBuildConstants.getConstantsForMode(buildMode);
28
30
  const isMavenModule = scoutBuildConstants.isMavenModule();
29
- const outDir = getOutputDir(isMavenModule, outSubDir);
31
+ const isWatchMode = nvl(args.watch, false);
32
+ const outDir = scoutBuildConstants.getOutputDir(buildMode);
30
33
  const resDirArray = args.resDirArray || ['res'];
31
- console.log(`Webpack mode: ${args.mode}`);
34
+ console.log(`Webpack mode: ${buildMode}`);
32
35
 
33
36
  // # Copy static web-resources delivered by the modules
34
37
  const copyPluginConfig = [];
@@ -41,17 +44,39 @@ module.exports = (env, args) => {
41
44
  });
42
45
  }
43
46
 
47
+ const minimizerTarget = ['firefox69', 'chrome71', 'safari12.1'];
48
+ const babelOptions = {
49
+ compact: false,
50
+ cacheDirectory: true,
51
+ cacheCompression: false,
52
+ presets: [
53
+ [require.resolve('@babel/preset-env'), {
54
+ debug: false,
55
+ targets: {
56
+ firefox: '69',
57
+ chrome: '71',
58
+ safari: '12.1'
59
+ }
60
+ }]
61
+ ]
62
+ };
63
+
64
+ // in prod mode always only transpile (no type-checks). In dev mode type checking is skipped in watch mode. Instead, ForkTsCheckerWebpackPlugin is used then (see below).
65
+ const transpileOnly = !devMode || isWatchMode;
66
+ const tsOptions = {
67
+ ...args.tsOptions,
68
+ transpileOnly: transpileOnly,
69
+ compilerOptions: {
70
+ noEmit: false,
71
+ ...args.tsOptions?.compilerOptions
72
+ }
73
+ };
74
+
44
75
  const config = {
45
- target: 'web',
46
- mode: args.mode,
47
- // In dev mode 'inline-source-map' is used (devtool is false because we use SourceMapDevToolPlugin)
48
- // Other source map types may increase build performance but decrease debugging experience
49
- // (e.g. wrong this in arrow functions with inline-cheap-module-source-map or not having original source code at all (code after babel transpilation instead of before) with eval types).
50
- // In production mode create external source maps without source code to map stack traces.
51
- // Otherwise stack traces would point to the minified source code which makes it quite impossible to analyze productive issues.
52
- devtool: devMode ? false : 'nosources-source-map',
76
+ mode: buildMode,
77
+ devtool: false, // disabled because SourceMapDevToolPlugin is used (see below)
78
+ ignoreWarnings: [(webpackError, compilation) => isWarningIgnored(devMode, webpackError, compilation)],
53
79
  resolve: {
54
-
55
80
  // no automatic polyfills. clients must add the desired polyfills themselves.
56
81
  fallback: {
57
82
  assert: false,
@@ -77,7 +102,8 @@ module.exports = (env, args) => {
77
102
  util: false,
78
103
  vm: false,
79
104
  zlib: false
80
- }
105
+ },
106
+ extensions: ['.ts', '.js', '.json', '.wasm', '.tsx', '.jsx']
81
107
  },
82
108
  // expect these apis in the browser
83
109
  externals: {
@@ -92,16 +118,15 @@ module.exports = (env, args) => {
92
118
  output: {
93
119
  filename: jsFilename,
94
120
  path: outDir,
95
- devtoolModuleFilenameTemplate: devMode ? undefined : prodDevtoolModuleFilenameTemplate,
96
- clean: nvl(args.clean, true)
121
+ clean: nvl(args.clean, false)
97
122
  },
98
123
  performance: {
99
124
  hints: false
100
125
  },
101
126
  profile: args.profile,
102
127
  module: {
103
- // LESS
104
128
  rules: [{
129
+ // LESS
105
130
  test: /\.less$/,
106
131
  use: [{
107
132
  // Extracts CSS into separate files. It creates a CSS file per JS file which contains CSS.
@@ -136,50 +161,48 @@ module.exports = (env, args) => {
136
161
  }
137
162
  }]
138
163
  }, {
139
- // # Babel
140
- test: /\.m?js$/,
141
- exclude: [],
142
- use: {
164
+ test: /\.tsx?$/,
165
+ exclude: /node_modules/,
166
+ use: [{
143
167
  loader: require.resolve('babel-loader'),
144
- options: {
145
- compact: false,
146
- cacheDirectory: true,
147
- cacheCompression: false,
148
- plugins: [
149
- require.resolve('@babel/plugin-transform-object-assign'),
150
- require.resolve('@babel/plugin-proposal-class-properties')],
151
- presets: [
152
- [require.resolve('@babel/preset-env'), {
153
- debug: false,
154
- targets: {
155
- firefox: '69',
156
- chrome: '71',
157
- safari: '12.1'
158
- }
159
- }]
160
- ]
161
- }
162
- }
168
+ options: babelOptions
169
+ }, {
170
+ loader: require.resolve('ts-loader'),
171
+ options: tsOptions
172
+ }]
163
173
  }, {
164
- // to support css imports (currently not used by Scout but might be used by included 3rd party libs)
165
- test: /\.css$/i,
174
+ test: /\.jsx?$/,
166
175
  use: [{
167
- loader: require.resolve('style-loader')
168
- }, {
169
- loader: require.resolve('css-loader'),
170
- options: {
171
- sourceMap: devMode,
172
- modules: false, // We don't want to work with CSS modules
173
- url: false // Don't resolve URLs in LESS, because relative path does not match /res/fonts
174
- }
176
+ loader: require.resolve('babel-loader'),
177
+ options: babelOptions
178
+ }]
179
+ }, {
180
+ test: /\.jsx?$/,
181
+ enforce: 'pre',
182
+ use: [{
183
+ loader: require.resolve('source-map-loader')
175
184
  }]
176
185
  }]
177
186
  },
178
187
  plugins: [
188
+ new WatchIgnorePlugin({paths: [/\.d\.ts$/]}),
179
189
  // see: extracts css into separate files
180
190
  new MiniCssExtractPlugin({filename: cssFilename}),
181
191
  // run post-build script hook
182
- new AfterEmitWebpackPlugin({outDir: outDir})
192
+ new AfterEmitWebpackPlugin({outDir: outDir}),
193
+ new SourceMapDevToolPlugin({
194
+ // Use external source maps in all modes because the browser is very slow in displaying a file containing large lines which is the case if source maps are inlined
195
+ filename: '[file].map',
196
+
197
+ // Don't create maps for static resources.
198
+ // They may already have maps which could lead to "multiple assets emit different content to the same file" exception.
199
+ exclude: /\/res\/.*/,
200
+
201
+ // In production mode create external source maps without source code to map stack traces.
202
+ // Otherwise, stack traces would point to the minified source code which makes it quite impossible to analyze productive issues.
203
+ noSources: !devMode,
204
+ moduleFilenameTemplate: devMode ? undefined : prodDevtoolModuleFilenameTemplate
205
+ })
183
206
  ],
184
207
  optimization: {
185
208
  splitChunks: {
@@ -189,49 +212,181 @@ module.exports = (env, args) => {
189
212
  }
190
213
  };
191
214
 
192
- // # Copy resources
215
+ // Copy resources only add the plugin if there are resources to copy. Otherwise, the plugin fails.
193
216
  if (copyPluginConfig.length > 0) {
194
- // only add the plugin if there are resources to copy. Otherwise the plugin fails.
195
217
  config.plugins.push(new CopyPlugin({patterns: copyPluginConfig}));
196
218
  }
197
219
 
220
+ // Shows progress information in the console in dev mode
198
221
  if (nvl(args.progress, true)) {
199
- // Shows progress information in the console in dev mode
200
- const webpack = require('webpack');
201
- config.plugins.push(new webpack.ProgressPlugin({profile: args.profile}));
222
+ config.plugins.push(new ProgressPlugin({profile: args.profile}));
202
223
  }
203
224
 
204
- if (!devMode) {
225
+ if (devMode) {
226
+ if (transpileOnly) { // devMode and no type-checks: perform checks asynchronously (watch mode).
227
+ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
228
+ const ForkTsCheckerNotifierWebpackPlugin = require('fork-ts-checker-notifier-webpack-plugin');
229
+
230
+ let forkTsCheckerConfig = undefined;
231
+ if (!fs.existsSync('./tsconfig.json')) {
232
+ // if the module has no tsconfig: use default from Scout.
233
+ // Otherwise, each module would need to provide a tsconfig even if there is no typescript code in the module.
234
+ forkTsCheckerConfig = {
235
+ typescript: {
236
+ configFile: require.resolve('@eclipse-scout/tsconfig'),
237
+ context: process.cwd(),
238
+ configOverwrite: {
239
+ compilerOptions: {skipLibCheck: true, sourceMap: false, inlineSourceMap: false, declarationMap: false, allowJs: true},
240
+ include: isMavenModule ? ['./src/main/js/**/*.ts', './src/main/js/**/*.js', './src/test/js/**/*.ts', './src/test/js/**/*.js']
241
+ : ['./src/**/*.ts', './src/**/*.js', './test/**/*.ts', './test/**/*.js']
242
+ }
243
+ }
244
+ };
245
+ }
246
+ config.plugins.push(new ForkTsCheckerWebpackPlugin(forkTsCheckerConfig));
247
+ config.plugins.push(new ForkTsCheckerNotifierWebpackPlugin({
248
+ title: getModuleName(),
249
+ skipSuccessful: true, // no notification for successful builds
250
+ excludeWarnings: true // no notification for warnings
251
+ }));
252
+ }
253
+ } else {
205
254
  const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
206
255
  const TerserPlugin = require('terser-webpack-plugin');
207
256
  config.optimization.minimizer = [
208
257
  // minify css
209
258
  new CssMinimizerPlugin({
210
- test: /\.min\.css$/g,
259
+ test: /\.min\.css$/i, // only minimize required files
260
+ exclude: /res[\\/]/i, // exclude resources output directory from minimizing as these files are copied
261
+ parallel: 4, // best ratio between memory consumption and performance on most systems
262
+ minify: CssMinimizerPlugin.esbuildMinify,
211
263
  minimizerOptions: {
212
- preset: ['default', {
213
- discardComments: {removeAll: true}
214
- }]
264
+ logLevel: 'error', // show messages directly to see the details. The message passed to webpack is only an object which is ignored in isWarningIgnored
265
+ sourcemap: false, // no sourcemaps for css in prod build (needs more heap memory instead)
266
+ charset: 'utf8', // default is ASCII which requires more escaping. UTF-8 allows for more compact code.
267
+ target: minimizerTarget
215
268
  }
216
269
  }),
217
270
  // minify js
218
271
  new TerserPlugin({
219
- test: /\.js(\?.*)?$/i,
220
- parallel: 4
272
+ test: /\.min\.js$/i, // only minimize required files
273
+ exclude: [/log4javascript-1\.4\.9[\\/]/i, /res[\\/]/i], // exclude resources output directory from minimizing as these files are copied
274
+ parallel: 4, // best ratio between memory consumption and performance on most systems
275
+ minify: TerserPlugin.esbuildMinify,
276
+ terserOptions: {
277
+ legalComments: 'none',
278
+ logLevel: 'error', // show messages directly to see the details. The message passed to webpack is only an object which is ignored in isWarningIgnored
279
+ charset: 'utf8', // default is ASCII which requires more escaping. UTF-8 allows for more compact code.
280
+ target: minimizerTarget
281
+ }
221
282
  })
222
283
  ];
223
284
  }
224
285
 
225
- if (devMode) {
226
- // Use external source maps also in dev mode because the browser is very slow in displaying a file containing large lines which is the case if source maps are inlined
227
- config.plugins.push(new webpack.SourceMapDevToolPlugin({
228
- filename: '[file].map'
229
- }));
230
- }
231
-
232
286
  return config;
233
287
  };
234
288
 
289
+ /**
290
+ * Creates a new object that contains the same keys as the given object. The values are replaced with the keys.
291
+ * So the resulting object looks like: {key1: key1, key2: key2}.
292
+ */
293
+ function toExternals(src, dest) {
294
+ if (!src) {
295
+ return;
296
+ }
297
+ return Object.keys(src).reduce((obj, current) => {
298
+ obj[current] = current;
299
+ return obj;
300
+ }, dest);
301
+ }
302
+
303
+ /**
304
+ * Converts the given base config to a library config meaning that all dependencies declared in the package.json are externalized by default.
305
+ *
306
+ * @param {object} config base config to convert to a library config
307
+ * @param {object} [options]
308
+ * @param {object} [options.externals] object holding custom externals for the module. See https://webpack.js.org/configuration/externals/ for details about supported formats and types.
309
+ * @param {boolean} [options.externalizeDevDeps] Add devDependencies as externals. Default is true.
310
+ * @param {boolean} [options.externalizePeerDeps] Add peerDependencies as externals. Default is true.
311
+ * @param {boolean} [options.externalizeBundledDeps] Add bundledDependencies as externals. Default is true.
312
+ * @param {boolean} [options.externalizeOptionalDeps] Add optionalDependencies as externals. Default is true.
313
+ */
314
+ function libraryConfig(config, options = {}) {
315
+ const packageJson = require(path.resolve('./package.json'));
316
+ const packageJsonExternals = {};
317
+ toExternals(packageJson.dependencies, packageJsonExternals);
318
+ if (options.externalizeDevDeps ?? true) {
319
+ toExternals(packageJson.devDependencies, packageJsonExternals);
320
+ }
321
+ if (options.externalizePeerDeps ?? true) {
322
+ toExternals(packageJson.peerDependencies, packageJsonExternals);
323
+ }
324
+ if (options.externalizeBundledDeps ?? true) {
325
+ toExternals(packageJson.bundledDependencies, packageJsonExternals);
326
+ }
327
+ if (options.externalizeOptionalDeps ?? true) {
328
+ toExternals(packageJson.optionalDependencies, packageJsonExternals);
329
+ }
330
+ packageJsonExternals.jquery = 'commonjs jquery'; // Make synthetic default import work (import $ from 'jquery') by importing jquery as commonjs module
331
+ const customExternals = options.externals || {};
332
+ const allExternals = {...packageJsonExternals, ...config.externals, ...customExternals};
333
+
334
+ // FileList is not necessary in library mode
335
+ let plugins = config.plugins.map(plugin => {
336
+ if (plugin instanceof AfterEmitWebpackPlugin) {
337
+ return new AfterEmitWebpackPlugin({outDir: plugin.options.outDir, createFileList: false});
338
+ }
339
+ return plugin;
340
+ });
341
+
342
+ return {
343
+ ...config,
344
+ optimization: {
345
+ ...config.optimization,
346
+ splitChunks: undefined // disable splitting
347
+ },
348
+ output: {
349
+ ...config.output,
350
+ library: {
351
+ type: 'module'
352
+ }
353
+ },
354
+ experiments: {
355
+ // required for library.type = 'module'
356
+ outputModule: true
357
+ },
358
+ plugins,
359
+ externals: (context, callback) => markExternals(allExternals, context, callback)
360
+ };
361
+ }
362
+
363
+ function markExternals(allExternals, context, callback) {
364
+ const request = context.request;
365
+ if (request.startsWith('.')) {
366
+ // fast check: continue without externalizing the import for relative paths
367
+ return callback();
368
+ }
369
+
370
+ if (allExternals[request]) {
371
+ // import matches exactly a declared dependency
372
+ return callback(null, allExternals[request]);
373
+ }
374
+
375
+ // check for files in sub-folders of an external
376
+ for (const [key, value] of Object.entries(allExternals)) {
377
+ if (request.startsWith(key + '/')) {
378
+ let result = request;
379
+ let spacePos = value.indexOf(' ');
380
+ if (spacePos > 0) {
381
+ result = value.substring(0, spacePos + 1) + result;
382
+ }
383
+ return callback(null, result);
384
+ }
385
+ }
386
+
387
+ callback(); // Continue without externalizing the import
388
+ }
389
+
235
390
  /**
236
391
  * @param {object} entry the webpack entry object
237
392
  * @param {object} options the options object to configure which themes should be built and how
@@ -264,13 +419,6 @@ function addThemes(entry, options = {}) {
264
419
  });
265
420
  }
266
421
 
267
- function getOutputDir(isMavenModule, outSubDir) {
268
- if (isMavenModule) {
269
- return path.resolve(scoutBuildConstants.outDir.target, scoutBuildConstants.outDir.dist, outSubDir);
270
- }
271
- return path.resolve(scoutBuildConstants.outDir.dist);
272
- }
273
-
274
422
  function computeChunkName(module, chunks, cacheGroupKey) {
275
423
  const entryPointDelim = '~';
276
424
  const allChunksNames = chunks
@@ -296,6 +444,7 @@ function computeChunkName(module, chunks, cacheGroupKey) {
296
444
 
297
445
  function computeModuleId(module) {
298
446
  const nodeModules = 'node_modules';
447
+ // noinspection JSUnresolvedVariable
299
448
  let id = module.userRequest;
300
449
  const nodeModulesPos = id.lastIndexOf(nodeModules);
301
450
  if (nodeModulesPos < 0) {
@@ -340,6 +489,17 @@ function nvl(arg, defaultValue) {
340
489
  return arg;
341
490
  }
342
491
 
492
+ function isWarningIgnored(devMode, webpackError) {
493
+ if (webpackError && webpackError.message === '[object Object]') {
494
+ return true; // esbuild warnings are not correctly passed to webpack. ignore them. The actual message is printed with the esbuild flag 'logLevel' (see below)
495
+ }
496
+
497
+ if (devMode || !webpackError || !webpackError.warning || !webpackError.warning.message) {
498
+ return false;
499
+ }
500
+ return webpackError.warning.message.startsWith('Failed to parse source map');
501
+ }
502
+
343
503
  /**
344
504
  * Don't reveal absolute file paths in production mode -> only return the file name relative to its module.
345
505
  * @param info.resourcePath
@@ -363,4 +523,38 @@ function prodDevtoolModuleFilenameTemplate(info) {
363
523
  }
364
524
  }
365
525
 
526
+ function getModuleName() {
527
+ let packageJsonFile = path.resolve('./package.json');
528
+ if (fs.existsSync(packageJsonFile)) {
529
+ let name = require(packageJsonFile).name;
530
+ if (name) {
531
+ return name;
532
+ }
533
+ }
534
+ return path.basename(process.cwd());
535
+ }
536
+
537
+ /**
538
+ * Externalize every import to the main index and replace it with newImport
539
+ * Keep imports to the excludedFolder.
540
+ * @param {string} newImport new name of the replaced import, typically the module name
541
+ * @param {string} excludedFolder imports to that folder won't be replaced
542
+ * @return a function that should be added to the webpack externals
543
+ */
544
+ function rewriteIndexImports(newImport, excludedFolder) {
545
+ return ({context, request, contextInfo}, callback) => {
546
+ // Externalize every import to the main index and replace it with @bsi-scout/datamodel
547
+ // Keep imports to the testing index
548
+ if (/\/index$/.test(request) && !path.resolve(context, request).includes(excludedFolder)) {
549
+ return callback(null, newImport);
550
+ }
551
+
552
+ // Continue without externalizing the import
553
+ callback();
554
+ };
555
+ }
556
+
366
557
  module.exports.addThemes = addThemes;
558
+ module.exports.libraryConfig = libraryConfig;
559
+ module.exports.markExternals = markExternals;
560
+ module.exports.rewriteIndexImports = rewriteIndexImports;
@@ -1,26 +0,0 @@
1
- /*
2
- * Copyright (c) 2010-2021 BSI Business Systems Integration AG.
3
- * All rights reserved. This program and the accompanying materials
4
- * are made available under the terms of the Eclipse Public License v1.0
5
- * which accompanies this distribution, and is available at
6
- * http://www.eclipse.org/legal/epl-v10.html
7
- *
8
- * Contributors:
9
- * BSI Business Systems Integration AG - initial API and implementation
10
- */
11
- const fs = require('fs');
12
- const path = require('path');
13
-
14
- const _getAllFiles = dir => {
15
- if (!fs.existsSync(dir)) {
16
- return [];
17
- }
18
-
19
- return fs.readdirSync(dir).reduce((files, file) => {
20
- const name = path.join(dir, file);
21
- const isDirectory = fs.statSync(name).isDirectory();
22
- return isDirectory ? [...files, ..._getAllFiles(name)] : [...files, name];
23
- }, []);
24
- };
25
-
26
- module.exports = _getAllFiles;