weboptimizer 4.0.4 → 4.0.5

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/browser.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Browser, InitializedBrowser } from './type';
2
+ import { Logger } from 'clientnode';
2
3
  export declare const browser: Browser;
3
- export declare const log: any;
4
+ export declare const log: Logger;
4
5
  /**
5
6
  * Provides a generic browser api in node or web contexts.
6
7
  * @param replaceWindow - Indicates whether a potential existing window object
package/configurator.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import type { ResolvedConfiguration } from './type';
2
+ import { Logger } from 'clientnode';
2
3
  export declare const require: NodeJS.Require;
3
4
  export declare const optionalRequire: <T = unknown>(id: string) => null | T;
4
5
  export declare let loadedConfiguration: null | ResolvedConfiguration;
5
- export declare const log: any;
6
+ export declare const log: Logger;
6
7
  /**
7
8
  * Main entry point to determine current configuration.
8
9
  * @param context - Location from where to build current application.
package/configurator.js CHANGED
@@ -296,7 +296,7 @@ environment = eval('process.env')) => {
296
296
  file: resolvedConfiguration.extensions.file.internal
297
297
  }, resolvedConfiguration.path.context,
298
298
  /*
299
- NOTE: We doesn't use
299
+ NOTE: We don't use
300
300
  "resolvedConfiguration.path.source.asset.base" because we
301
301
  already have resolved all module ids.
302
302
  */
@@ -320,7 +320,7 @@ environment = eval('process.env')) => {
320
320
  }
321
321
  resolvedConfiguration.module.aliases.webOptimizerDefaultTemplateFilePath = resolvedConfiguration.files.defaultHTML.template.filePath;
322
322
  // endregion
323
- // region apply html webpack plugin workarounds
323
+ // region apply HTML webpack plugin workarounds
324
324
  /*
325
325
  NOTE: Provides a workaround to handle a bug with chained loader
326
326
  configurations.
@@ -342,7 +342,7 @@ environment = eval('process.env')) => {
342
342
  * @returns Nothing.
343
343
  */
344
344
  export const get = async () => {
345
- if (loadedConfiguration) return loadedConfiguration;
346
- return await load();
345
+ if (!loadedConfiguration) loadedConfiguration = await load();
346
+ return loadedConfiguration;
347
347
  };
348
348
  export default get;
package/ejsLoader.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { Encoding, Mapping } from 'clientnode';
2
2
  import type { Options, TemplateFunction as EJSTemplateFunction } from 'ejs';
3
3
  import type { LoaderContext } from 'webpack';
4
4
  import type { Extensions, Replacements } from './type';
5
+ import { Logger } from 'clientnode';
5
6
  export type TemplateFunction = EJSTemplateFunction;
6
7
  export type CompilerOptions = Options & {
7
8
  encoding: Encoding;
@@ -24,7 +25,7 @@ export type LoaderConfiguration = Mapping<unknown> & {
24
25
  replacements: Replacements;
25
26
  };
26
27
  };
27
- export declare const log: any;
28
+ export declare const log: Logger;
28
29
  /**
29
30
  * Main transformation function.
30
31
  * @param source - Input string to transform.
package/helper.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { Encoding, Mapping } from 'clientnode';
2
2
  import type { BuildConfiguration, Extensions, GivenInjection, GivenInjectionConfiguration, NormalizedGivenInjection, PathConfiguration, PackageDescriptor, Replacements, ResolvedBuildConfiguration, SpecificExtensions } from './type';
3
+ import { Logger } from 'clientnode';
3
4
  export declare const KNOWN_FILE_EXTENSIONS: Array<string>;
4
- export declare const log: any;
5
+ export declare const log: Logger;
5
6
  /**
6
7
  * Determines whether given file path is within given list of file locations.
7
8
  * @param filePath - Path to file to check.
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env babel-node
2
- export declare const log: any;
2
+ import { Logger } from 'clientnode';
3
+ export declare const log: Logger;
3
4
  /**
4
5
  * Main entry point.
5
6
  * @param context - Location from where to build current application.
package/index.js CHANGED
@@ -27,7 +27,7 @@ import { exec as execChildProcess, spawn as spawnChildProcess } from 'child_proc
27
27
  import { CLOSE_EVENT_NAMES, copyDirectoryRecursiveSync, copyFileSync, evaluate, getProcessCloseHandler, handleChildProcess, importsPromise, isDirectory, isDirectorySync, isFile, isFileSync, isPlainObject, Logger, MAXIMAL_NUMBER_OF_ITERATIONS, NOOP, parseEncodedObject, walkDirectoryRecursively } from 'clientnode';
28
28
  import { chmodSync, unlinkSync } from 'fs';
29
29
  import { writeFile, unlink } from 'fs/promises';
30
- import globAll from 'glob-all';
30
+ import { sync as globAllSync } from 'glob-all';
31
31
  import path, { join, resolve } from 'path';
32
32
  import { rimraf as removeDirectoryRecursively, sync as removeDirectoryRecursivelySync } from 'rimraf';
33
33
  import { load as loadConfiguration } from "./configurator.js";
@@ -105,7 +105,7 @@ environment = eval('process.env')) => {
105
105
  // endregion
106
106
  // region handle clear
107
107
  /*
108
- NOTE: Some tasks could depend on previously created artefacts
108
+ NOTE: Some tasks could depend on previously created artifacts
109
109
  packages so a preceding clear should not be performed in that
110
110
  cases.
111
111
  NOTE: If we have a dependency cycle we need to preserve files
@@ -133,14 +133,12 @@ environment = eval('process.env')) => {
133
133
  }
134
134
  });
135
135
  for (const file of await walkDirectoryRecursively(configuration.path.target.base, () => false, configuration.encoding)) if (file.name.startsWith('npm-debug')) await unlink(file.path);
136
- } else {
137
- await removeDirectoryRecursively(configuration.path.target.base);
138
- }
136
+ } else await removeDirectoryRecursively(configuration.path.target.base);
139
137
  if (await isDirectory(configuration.path.apiDocumentation)) await removeDirectoryRecursively(configuration.path.apiDocumentation);
140
138
  for (const filePath of configuration.path.tidyUpOnClear) if (filePath) if (isFileSync(filePath))
141
139
  // NOTE: Close handler have to be synchronous.
142
140
  unlinkSync(filePath);else if (isDirectorySync(filePath)) removeDirectoryRecursivelySync(filePath);
143
- removeDirectoryRecursivelySync(globAll.sync(configuration.path.tidyUpOnClearGlobs));
141
+ removeDirectoryRecursivelySync(globAllSync(configuration.path.tidyUpOnClearGlobs));
144
142
  }
145
143
  // endregion
146
144
  // region handle build
@@ -174,7 +172,7 @@ environment = eval('process.env')) => {
174
172
  for (const filePath of configuration.path.tidyUp) if (filePath) if (isFileSync(filePath))
175
173
  // NOTE: Close handler have to be synchronous.
176
174
  unlinkSync(filePath);else if (isDirectorySync(filePath)) removeDirectoryRecursivelySync(filePath);
177
- removeDirectoryRecursivelySync(globAll.sync(configuration.path.tidyUpGlobs));
175
+ removeDirectoryRecursivelySync(globAllSync(configuration.path.tidyUpGlobs));
178
176
  };
179
177
  closeEventHandlers.push(tidyUp);
180
178
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weboptimizer",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "description": "A generic web optimizer, (module) bundler and development environment.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -95,7 +95,7 @@
95
95
  "babel-plugin-polyfill-corejs3": "^1.0.0",
96
96
  "babel-plugin-transform-rewrite-imports": "^1.5.4",
97
97
  "babel-preset-minify": "^0.5.2",
98
- "clientnode": "4.0.1430",
98
+ "clientnode": "4.0.1432",
99
99
  "core-js": "^3.49.0",
100
100
  "ejs": "^6.0.1",
101
101
  "exports-loader": "^5.0.0",
@@ -1,4 +1,5 @@
1
1
  import type { WebpackConfiguration } from './type';
2
- export declare const log: any;
2
+ import { Logger } from 'clientnode';
3
+ export declare const log: Logger;
3
4
  export declare let webpackConfiguration: WebpackConfiguration;
4
5
  export default webpackConfiguration;