weboptimizer 4.0.4 → 4.0.6
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 +2 -1
- package/configurator.d.ts +2 -1
- package/configurator.js +4 -4
- package/ejsLoader.d.ts +2 -1
- package/helper.d.ts +2 -1
- package/index.d.ts +2 -1
- package/index.js +7 -6
- package/package.json +2 -2
- package/webpackConfigurator.d.ts +2 -1
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:
|
|
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:
|
|
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
|
|
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
|
|
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)
|
|
346
|
-
return
|
|
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:
|
|
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:
|
|
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
package/index.js
CHANGED
|
@@ -28,6 +28,9 @@ import { CLOSE_EVENT_NAMES, copyDirectoryRecursiveSync, copyFileSync, evaluate,
|
|
|
28
28
|
import { chmodSync, unlinkSync } from 'fs';
|
|
29
29
|
import { writeFile, unlink } from 'fs/promises';
|
|
30
30
|
import globAll from 'glob-all';
|
|
31
|
+
const {
|
|
32
|
+
sync: globAllSync
|
|
33
|
+
} = globAll;
|
|
31
34
|
import path, { join, resolve } from 'path';
|
|
32
35
|
import { rimraf as removeDirectoryRecursively, sync as removeDirectoryRecursivelySync } from 'rimraf';
|
|
33
36
|
import { load as loadConfiguration } from "./configurator.js";
|
|
@@ -105,7 +108,7 @@ environment = eval('process.env')) => {
|
|
|
105
108
|
// endregion
|
|
106
109
|
// region handle clear
|
|
107
110
|
/*
|
|
108
|
-
NOTE: Some tasks could depend on previously created
|
|
111
|
+
NOTE: Some tasks could depend on previously created artifacts
|
|
109
112
|
packages so a preceding clear should not be performed in that
|
|
110
113
|
cases.
|
|
111
114
|
NOTE: If we have a dependency cycle we need to preserve files
|
|
@@ -133,14 +136,12 @@ environment = eval('process.env')) => {
|
|
|
133
136
|
}
|
|
134
137
|
});
|
|
135
138
|
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
|
-
}
|
|
139
|
+
} else await removeDirectoryRecursively(configuration.path.target.base);
|
|
139
140
|
if (await isDirectory(configuration.path.apiDocumentation)) await removeDirectoryRecursively(configuration.path.apiDocumentation);
|
|
140
141
|
for (const filePath of configuration.path.tidyUpOnClear) if (filePath) if (isFileSync(filePath))
|
|
141
142
|
// NOTE: Close handler have to be synchronous.
|
|
142
143
|
unlinkSync(filePath);else if (isDirectorySync(filePath)) removeDirectoryRecursivelySync(filePath);
|
|
143
|
-
removeDirectoryRecursivelySync(
|
|
144
|
+
removeDirectoryRecursivelySync(globAllSync(configuration.path.tidyUpOnClearGlobs));
|
|
144
145
|
}
|
|
145
146
|
// endregion
|
|
146
147
|
// region handle build
|
|
@@ -174,7 +175,7 @@ environment = eval('process.env')) => {
|
|
|
174
175
|
for (const filePath of configuration.path.tidyUp) if (filePath) if (isFileSync(filePath))
|
|
175
176
|
// NOTE: Close handler have to be synchronous.
|
|
176
177
|
unlinkSync(filePath);else if (isDirectorySync(filePath)) removeDirectoryRecursivelySync(filePath);
|
|
177
|
-
removeDirectoryRecursivelySync(
|
|
178
|
+
removeDirectoryRecursivelySync(globAllSync(configuration.path.tidyUpGlobs));
|
|
178
179
|
};
|
|
179
180
|
closeEventHandlers.push(tidyUp);
|
|
180
181
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
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.
|
|
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",
|
package/webpackConfigurator.d.ts
CHANGED