@fontoxml/fontoxml-development-tools 3.9.0 → 3.10.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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@fontoxml/fontoxml-development-tools",
3
- "version": "3.9.0",
3
+ "version": "3.10.0-beta.3",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@fontoxml/fontoxml-development-tools",
9
- "version": "3.9.0",
9
+ "version": "3.10.0-beta.3",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@babel/core": "7.14.6",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fontoxml/fontoxml-development-tools",
3
3
  "description": "Development tools for Fonto.",
4
- "version": "3.9.0",
4
+ "version": "3.10.0-beta.3",
5
5
  "author": "The Fonto Team",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -1,3 +1,4 @@
1
+ import correlationIdRepository from './correlationIdRepository.js';
1
2
  import DevelopmentCms from './stores/DevelopmentCms.js';
2
3
 
3
4
  export default function (config) {
@@ -6,6 +7,10 @@ export default function (config) {
6
7
  return (req, _res, next) => {
7
8
  req.cms = cms;
8
9
 
10
+ req.repositories = {
11
+ correlationId: correlationIdRepository,
12
+ };
13
+
9
14
  next();
10
15
  };
11
16
  }
@@ -16,7 +16,7 @@ export default function getPatternsForSpecialFileType(type) {
16
16
  return ['src/*.@(js|jsx|ts|tsx)', '!src/*.d.ts'];
17
17
  case 'unitTestSpecs':
18
18
  return ['test/**/*.tests.@(js|ts)'];
19
- case 'unitTestUseConfigurationManager':
19
+ case 'unitTestConfigurationManager':
20
20
  return [];
21
21
  default:
22
22
  throw new Error(`Unsupported special file type "${type}".`);
@@ -311,7 +311,7 @@ async function handleUnitTest({
311
311
  code = statements
312
312
  .map((statement) => `import '${statement.path}';`)
313
313
  .join('\n');
314
- } else if (type === 'unitTestUseConfigurationManager') {
314
+ } else if (type === 'unitTestConfigurationManager') {
315
315
  // packagesInfoInLoadOrder is filtered for the unit test types, so get them all again.
316
316
  const allPackagesInfoInLoadOrder =
317
317
  loaderContext._compilation.packagesInfoInLoadOrder;
@@ -323,7 +323,9 @@ async function handleUnitTest({
323
323
  );
324
324
 
325
325
  const useConfigurationManager = !!dependsOnFontoxmlConfigurationPackage;
326
- code = `export default ${useConfigurationManager};`;
326
+ code = useConfigurationManager
327
+ ? `export { default } from 'fontoxml-configuration/src/configurationManager';`
328
+ : `export default null;`;
327
329
  }
328
330
 
329
331
  code = code.trim();
@@ -386,7 +388,7 @@ module.exports = async function generatedLoader(input, inputMap) {
386
388
  case 'unitTestConfiguration':
387
389
  case 'unitTestSmokeTest':
388
390
  case 'unitTestSpecs':
389
- case 'unitTestUseConfigurationManager':
391
+ case 'unitTestConfigurationManager':
390
392
  return handleUnitTest(handlerOptions);
391
393
  case 'versionInfo':
392
394
  return handleVersionInfo(handlerOptions);
@@ -8,8 +8,6 @@ import webpack from 'webpack';
8
8
 
9
9
  import normalisePath from '../helpers/normalisePath.js';
10
10
 
11
- const emittedAssets = new Map();
12
-
13
11
  const __filename = fileURLToPath(import.meta.url);
14
12
  const __dirname = path.dirname(__filename);
15
13
 
@@ -26,12 +24,14 @@ export default class CopyPlugin {
26
24
  * @param {Compiler} compiler
27
25
  */
28
26
  apply(compiler) {
27
+ const emittedAssets = new Map();
28
+
29
29
  let packageInfos;
30
30
 
31
31
  compiler.hooks.thisCompilation.tap(CopyPlugin.name, (compilation) => {
32
- compilation.hooks.additionalAssets.tapAsync(
32
+ compilation.hooks.additionalAssets.tapPromise(
33
33
  CopyPlugin.name,
34
- async (callback) => {
34
+ async () => {
35
35
  if (
36
36
  compilation.packagesInfoInLoadOrderError ||
37
37
  !compilation.packagesInfoInLoadOrder
@@ -43,7 +43,7 @@ export default class CopyPlugin {
43
43
  );
44
44
  packageInfos = error.packageInfos || [];
45
45
  compilation.errors.push(error);
46
- return callback();
46
+ return;
47
47
  }
48
48
 
49
49
  const templatesPath = normalisePath(
@@ -207,77 +207,64 @@ export default class CopyPlugin {
207
207
  }
208
208
  )
209
209
  );
210
-
211
- return callback();
212
210
  }
213
211
  );
212
+ });
214
213
 
215
- compiler.hooks.afterEmit.tapAsync(
216
- CopyPlugin.name,
217
- async (compilation, callback) => {
218
- await Promise.all(
219
- packageInfos.map(async (packageInfo) => {
220
- const packagePath = path.normalize(
221
- packageInfo.path
222
- );
214
+ compiler.hooks.afterEmit.tapPromise(
215
+ CopyPlugin.name,
216
+ async (compilation) => {
217
+ await Promise.all(
218
+ packageInfos.map(async (packageInfo) => {
219
+ const packagePath = path.normalize(packageInfo.path);
223
220
 
224
- if (
225
- packagePath ===
226
- path.join(
227
- this.options.platformFolder,
228
- packageInfo.name
229
- )
230
- ) {
231
- return;
232
- }
221
+ if (
222
+ packagePath ===
223
+ path.join(
224
+ this.options.platformFolder,
225
+ packageInfo.name
226
+ )
227
+ ) {
228
+ return;
229
+ }
230
+
231
+ if (packageInfo.name === 'config') {
232
+ compilation.contextDependencies.add(packagePath);
233
+ } else {
234
+ const srcFolderPath = path.join(packagePath, 'src');
235
+ const hasSrcFolder = await fs.pathExists(
236
+ srcFolderPath
237
+ );
233
238
 
234
- if (packageInfo.name === 'config') {
239
+ if (hasSrcFolder) {
235
240
  compilation.contextDependencies.add(
236
- packagePath
241
+ srcFolderPath
237
242
  );
238
243
  } else {
239
- const srcFolderPath = path.join(
240
- packagePath,
241
- 'src'
242
- );
243
- const hasSrcFolder = await fs.pathExists(
244
+ compilation.missingDependencies.add(
244
245
  srcFolderPath
245
246
  );
246
-
247
- if (hasSrcFolder) {
248
- compilation.contextDependencies.add(
249
- srcFolderPath
250
- );
251
- } else {
252
- compilation.missingDependencies.add(
253
- srcFolderPath
254
- );
255
- }
256
247
  }
248
+ }
257
249
 
258
- const fontoManifestPath = path.join(
259
- packagePath,
260
- 'fonto-manifest.json'
261
- );
262
- const hasManifest = await fs.pathExists(
250
+ const fontoManifestPath = path.join(
251
+ packagePath,
252
+ 'fonto-manifest.json'
253
+ );
254
+ const hasManifest = await fs.pathExists(
255
+ fontoManifestPath
256
+ );
257
+
258
+ if (hasManifest) {
259
+ compilation.fileDependencies.add(fontoManifestPath);
260
+ } else {
261
+ compilation.missingDependencies.add(
263
262
  fontoManifestPath
264
263
  );
265
-
266
- if (hasManifest) {
267
- compilation.fileDependencies.add(
268
- fontoManifestPath
269
- );
270
- } else {
271
- compilation.missingDependencies.add(
272
- fontoManifestPath
273
- );
274
- }
275
- })
276
- );
277
-
278
- return callback();
279
- }
280
- );
281
- });
264
+ }
265
+ })
266
+ );
267
+ }
268
+ );
282
269
  }
283
270
  }