weboptimizer 2.0.1442 → 2.0.1444
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 +3 -3
- package/test/browser.js +0 -37
- package/test/configurator.js +0 -16
- package/test/ejsLoader.js +0 -53
- package/test/helper.js +0 -397
- package/test/index.js +0 -44
- package/test/stylelintConfigurator.js +0 -16
- package/test/webpackConfigurator.js +0 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1444",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"build:types": "tsc --declaration --emitDeclarationOnly",
|
|
70
70
|
"check": "yarn check:types; yarn lint",
|
|
71
71
|
"check:types": "tsc --noEmit",
|
|
72
|
-
"clear": "rimraf apiDocumentation 'plugins/*.d.ts' 'plugins/*.js' browser.d.ts configurator.d.ts ejsLoader.d.ts helper.d.ts index.d.ts jestSetup.d.ts jestEnvironmentBrowser.d.ts stylelintConfigurator.d.ts type.d.ts webpackConfigurator.d.ts '*.js' '*.compiled.*' '*.compiled' 'test/*.js' 'test/*.compiled.*' 'test/*.d.ts' '*.html' '*.log' node_modules/weboptimizer .coverage .nyc_output || true",
|
|
72
|
+
"clear": "rimraf --glob apiDocumentation 'plugins/*.d.ts' 'plugins/*.js' browser.d.ts configurator.d.ts ejsLoader.d.ts helper.d.ts index.d.ts jestSetup.d.ts jestEnvironmentBrowser.d.ts stylelintConfigurator.d.ts type.d.ts webpackConfigurator.d.ts '*.js' '*.compiled.*' '*.compiled' 'test/*.js' 'test/*.compiled.*' 'test/*.d.ts' '*.html' '*.log' node_modules/weboptimizer .coverage .nyc_output || true",
|
|
73
73
|
"document": "yarn build:plain && jsdoc --package ./package.json --readme ./readme.md --destination apiDocumentation *.js",
|
|
74
74
|
"lint": "yarn lint:base",
|
|
75
75
|
"lint:base": "eslint --ignore-pattern '**/exclude/*' --ignore-pattern '*.compiled.*' --ignore-pattern '*.d.ts' --ignore-pattern '*.js' --parser-options=project:tsconfig.json '*.ts' 'test/*.ts'",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"babel-loader": "*",
|
|
98
98
|
"babel-plugin-transform-modern-regexp": "*",
|
|
99
99
|
"babel-preset-minify": "*",
|
|
100
|
-
"clientnode": "^3.0.
|
|
100
|
+
"clientnode": "^3.0.1128",
|
|
101
101
|
"ejs": "*",
|
|
102
102
|
"exports-loader": "*",
|
|
103
103
|
"extract-loader": "*",
|
package/test/browser.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// #!/usr/bin/env babel-node
|
|
2
|
-
// -*- coding: utf-8 -*-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
// region imports
|
|
6
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
7
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
8
|
-
var _globals = require("@jest/globals");
|
|
9
|
-
var _clientnode = _interopRequireDefault(require("clientnode"));
|
|
10
|
-
var _browser = _interopRequireWildcard(require("../browser"));
|
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
13
|
-
// endregion
|
|
14
|
-
(0, _globals.test)('browser', function (done) {
|
|
15
|
-
(0, _globals.expect)(_browser.browser.debug).toStrictEqual(false);
|
|
16
|
-
(0, _globals.expect)(_browser.browser.domContentLoaded).toStrictEqual(false);
|
|
17
|
-
(0, _globals.expect)(_browser.browser.initialized).toStrictEqual(false);
|
|
18
|
-
(0, _globals.expect)(_browser.browser.windowLoaded).toStrictEqual(false);
|
|
19
|
-
(0, _browser["default"])().then(function (initializedBrowser) {
|
|
20
|
-
(0, _globals.expect)(initializedBrowser).toStrictEqual(_browser.browser);
|
|
21
|
-
(0, _globals.expect)(_browser.browser.initialized).toStrictEqual(true);
|
|
22
|
-
(0, _globals.expect)(_browser.browser.window).toHaveProperty('document');
|
|
23
|
-
if (_browser.browser.window) (0, _globals.expect)(_browser.browser.window.document).toHaveProperty('location');
|
|
24
|
-
var onWindowLoaded = function onWindowLoaded(event) {
|
|
25
|
-
(0, _globals.expect)(event).toBeInstanceOf(Object);
|
|
26
|
-
(0, _globals.expect)(_browser.browser.domContentLoaded).toStrictEqual(true);
|
|
27
|
-
if (_browser.browser.window) (0, _globals.expect)(_browser.browser.window.document.querySelector('body')).toBeInstanceOf(Object);
|
|
28
|
-
(0, _globals.expect)(_browser.browser.windowLoaded).toStrictEqual(true);
|
|
29
|
-
done();
|
|
30
|
-
};
|
|
31
|
-
if (_browser.browser.windowLoaded) onWindowLoaded(new Event('load'));else if (_browser.browser.window) _browser.browser.window.addEventListener('load', onWindowLoaded);else done();
|
|
32
|
-
}, _clientnode["default"].noop);
|
|
33
|
-
});
|
|
34
|
-
// region vim modline
|
|
35
|
-
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
|
36
|
-
// vim: foldmethod=marker foldmarker=region,endregion:
|
|
37
|
-
// endregion
|
package/test/configurator.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// #!/usr/bin/env babel-node
|
|
2
|
-
// -*- coding: utf-8 -*-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
// region imports
|
|
6
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
7
|
-
var _globals = require("@jest/globals");
|
|
8
|
-
var _configurator = _interopRequireDefault(require("../configurator"));
|
|
9
|
-
// endregion
|
|
10
|
-
(0, _globals.test)('loadConfiguration', function () {
|
|
11
|
-
return (0, _globals.expect)((0, _configurator["default"])()).toHaveProperty('name', 'mockup');
|
|
12
|
-
});
|
|
13
|
-
// region vim modline
|
|
14
|
-
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
|
15
|
-
// vim: foldmethod=marker foldmarker=region,endregion:
|
|
16
|
-
// endregion
|
package/test/ejsLoader.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// #!/usr/bin/env babel-node
|
|
2
|
-
// -*- coding: utf-8 -*-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
// region imports
|
|
6
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
7
|
-
var _globals = require("@jest/globals");
|
|
8
|
-
var _clientnode = _interopRequireDefault(require("clientnode"));
|
|
9
|
-
var _ejsLoader = _interopRequireDefault(require("../ejsLoader"));
|
|
10
|
-
// endregion
|
|
11
|
-
// region mockup
|
|
12
|
-
var context = {
|
|
13
|
-
debug: false,
|
|
14
|
-
loaders: [],
|
|
15
|
-
resourcePath: '',
|
|
16
|
-
query: ''
|
|
17
|
-
};
|
|
18
|
-
// endregion
|
|
19
|
-
(0, _globals.describe)('ejsLoader', function () {
|
|
20
|
-
// region tests
|
|
21
|
-
(0, _globals.test)('loader', function () {
|
|
22
|
-
(0, _globals.expect)(_ejsLoader["default"].call(context, '<a></a>')).toStrictEqual('<a></a>');
|
|
23
|
-
var complexContext = _clientnode["default"].extend(true, _clientnode["default"].copy(context), {
|
|
24
|
-
cacheable: _clientnode["default"].noop,
|
|
25
|
-
getOptions: function getOptions() {
|
|
26
|
-
return this.query;
|
|
27
|
-
},
|
|
28
|
-
query: {
|
|
29
|
-
compiler: {
|
|
30
|
-
strict: true
|
|
31
|
-
},
|
|
32
|
-
locals: {
|
|
33
|
-
test: 'hans'
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
(0, _globals.expect)(_ejsLoader["default"].call(complexContext, '<a><%- test %></a>')).toStrictEqual('<a>hans</a>');
|
|
38
|
-
(0, _globals.expect)(_ejsLoader["default"].call(complexContext, "<a></a><%- include('<a>test</a>?{options: {isString: true}}') %>")).toStrictEqual('<a></a><a>test</a>');
|
|
39
|
-
complexContext.query.compileSteps = 0;
|
|
40
|
-
(0, _globals.expect)(_ejsLoader["default"].call(complexContext, '<a></a>')).toStrictEqual('<a></a>');
|
|
41
|
-
complexContext.query.compileSteps = 1;
|
|
42
|
-
(0, _globals.expect)(_ejsLoader["default"].call(complexContext, '<a></a>').startsWith("'use strict';\nmodule.exports=")).toStrictEqual(true);
|
|
43
|
-
complexContext.query.compileSteps = 2;
|
|
44
|
-
(0, _globals.expect)(_ejsLoader["default"].call(complexContext, '<a></a>')).toStrictEqual('<a></a>');
|
|
45
|
-
complexContext.query.compileSteps = 3;
|
|
46
|
-
(0, _globals.expect)(_ejsLoader["default"].call(complexContext, '<a></a>').startsWith("'use strict';\nmodule.exports=")).toStrictEqual(true);
|
|
47
|
-
});
|
|
48
|
-
// endregion
|
|
49
|
-
});
|
|
50
|
-
// region vim modline
|
|
51
|
-
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
|
52
|
-
// vim: foldmethod=marker foldmarker=region,endregion:
|
|
53
|
-
// endregion
|
package/test/helper.js
DELETED
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
// #!/usr/bin/env babel-node
|
|
2
|
-
// -*- coding: utf-8 -*-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
// region imports
|
|
6
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
7
|
-
var _globals = require("@jest/globals");
|
|
8
|
-
var _clientnode = require("clientnode");
|
|
9
|
-
var _testHelper = require("clientnode/testHelper");
|
|
10
|
-
var _path = require("path");
|
|
11
|
-
var _helper = _interopRequireDefault(require("../helper"));
|
|
12
|
-
// endregion
|
|
13
|
-
// region mockup
|
|
14
|
-
var buildConfiguration = {
|
|
15
|
-
example: {
|
|
16
|
-
extension: 'example',
|
|
17
|
-
filePathPattern: '',
|
|
18
|
-
ignoredExtension: '',
|
|
19
|
-
outputExtension: 'example'
|
|
20
|
-
},
|
|
21
|
-
javaScript: {
|
|
22
|
-
extension: 'js',
|
|
23
|
-
filePathPattern: '',
|
|
24
|
-
ignoredExtension: '',
|
|
25
|
-
outputExtension: 'js'
|
|
26
|
-
},
|
|
27
|
-
other: {
|
|
28
|
-
extension: 'other',
|
|
29
|
-
filePathPattern: '',
|
|
30
|
-
ignoredExtension: '',
|
|
31
|
-
outputExtension: 'other'
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
// endregion
|
|
35
|
-
(0, _globals.describe)('helper', function () {
|
|
36
|
-
// region tests
|
|
37
|
-
/// region boolean
|
|
38
|
-
(0, _testHelper.testEach)('isFilePathInLocation', _helper["default"].isFilePathInLocation, [true, './', ['./']], [true, './', ['../']], [false, '../', ['./']]);
|
|
39
|
-
/// endregion
|
|
40
|
-
/// region string
|
|
41
|
-
(0, _testHelper.testEach)('stripLoader', _helper["default"].stripLoader, ['', ''], ['a', 'a'], ['b', 'a!b'], ['c', 'aa!b!c'], ['c', 'aa!b!c'], ['c', 'c?a'], ['c', 'aa!b!c?a'], ['c', 'aa!b!c?abb?'], ['c', 'aa!b!c?abb?a'], ['moduleName', 'imports?$=library!moduleName']);
|
|
42
|
-
/// endregion
|
|
43
|
-
/// region array
|
|
44
|
-
(0, _testHelper.testEach)('normalizePaths', _helper["default"].normalizePaths, [[], []], [['a'], ['a']], [['a'], ['a/']], [['a'], ['a/', 'a']], [['a'], ['a/', 'a/']], [['a', 'b'], ['a/', 'a/', 'b/']], [['a', 'b'], ['a/', 'a/', 'b']], [['a', 'b', '.'], ['a/', 'a/', 'b', '', '.']]);
|
|
45
|
-
/// endregion
|
|
46
|
-
/// region file handler
|
|
47
|
-
(0, _testHelper.testEach)('renderFilePathTemplate', _helper["default"].renderFilePathTemplate, ['', '', {}], ['a', 'a', {}], ['path', 'path', {}], ['a.__dummy__b', 'a[name]b', {}], ['a.__dummy__b.__dummy__', 'a[name]b[name]', {}], ['a.__dummy__b.__dummy__', 'a[id]b[chunkhash]', {}], ['a1b2', 'a[id]b[chunkhash]', {
|
|
48
|
-
'[id]': 1,
|
|
49
|
-
'[chunkhash]': 2
|
|
50
|
-
}], ['a[id]b[chunkhash]', 'a[id]b[chunkhash]', {
|
|
51
|
-
'[id]': '[id]',
|
|
52
|
-
'[chunkhash]': '[chunkhash]'
|
|
53
|
-
}]);
|
|
54
|
-
(0, _testHelper.testEach)('applyContext', _helper["default"].applyContext, ['', ''], ['a', 'a'], ['a', 'a', './'], ['./a', './a', './'], ['./a', './a', './', './'], ['a/a', './a', './a', './'], ['./a', './a', './a', './a'], ['./a', './a', './a', './a', {
|
|
55
|
-
a: 'b'
|
|
56
|
-
}], ['b/a', './a', './a/a', './', {
|
|
57
|
-
a: 'b'
|
|
58
|
-
}, {}, ['a']]);
|
|
59
|
-
(0, _testHelper.testEach)('determineExternalRequest', _helper["default"].determineExternalRequest, [null, ''], ['a', 'a'], ['path', 'path'], [null, './helper'], [null, './helper', './'], [null, './helper', '../'], ['./helper', './helper', './a'], [null, './helper', './', './'], ['a/a', './a', './', './node_modules/a'], ['a', './', './', 'a'], ['path', 'path', './', './', {}, []], ['./main.js', 'path', './', './', {}, [], {
|
|
60
|
-
path: './main.js'
|
|
61
|
-
}], ['main.js', 'path', './', './', {}, [], {
|
|
62
|
-
path: 'main.js'
|
|
63
|
-
}], [null, 'path', './', './', {}, [], {
|
|
64
|
-
path: './helper.ts'
|
|
65
|
-
}], ['webpack', 'webpack'], ['webpack', 'a', './', './', {}, ['node_modules'], {
|
|
66
|
-
a$: 'webpack'
|
|
67
|
-
}], [null, 'a', './', './', {
|
|
68
|
-
a: ['webpack']
|
|
69
|
-
}, ['node_modules'], {
|
|
70
|
-
a$: 'webpack'
|
|
71
|
-
}], ['webpack', 'a', '../', './', {
|
|
72
|
-
a: ['not_webpack']
|
|
73
|
-
}, ['node_modules'], {
|
|
74
|
-
a$: 'webpack'
|
|
75
|
-
}, {}, {
|
|
76
|
-
file: {
|
|
77
|
-
external: [],
|
|
78
|
-
internal: []
|
|
79
|
-
}
|
|
80
|
-
}], ['webpack', 'a', '../', './', {
|
|
81
|
-
a: ['webpack']
|
|
82
|
-
}, ['node_modules'], {
|
|
83
|
-
a$: 'webpack'
|
|
84
|
-
}, {}, {
|
|
85
|
-
file: {
|
|
86
|
-
external: ['.js'],
|
|
87
|
-
internal: ['.js']
|
|
88
|
-
}
|
|
89
|
-
}, './', ['./']], [null, 'a', './', './', {
|
|
90
|
-
a: ['webpack']
|
|
91
|
-
}, ['node_modules'], {
|
|
92
|
-
a$: 'webpack'
|
|
93
|
-
}, {}, {
|
|
94
|
-
file: {
|
|
95
|
-
external: ['.js'],
|
|
96
|
-
internal: ['.js']
|
|
97
|
-
}
|
|
98
|
-
}, './', ['.git']], ['webpack', 'a', './', './', {
|
|
99
|
-
a: ['webpack']
|
|
100
|
-
}, ['node_modules'], {
|
|
101
|
-
a$: 'webpack'
|
|
102
|
-
}, {}, {
|
|
103
|
-
file: {
|
|
104
|
-
external: ['.js'],
|
|
105
|
-
internal: ['.js']
|
|
106
|
-
}
|
|
107
|
-
}, './', ['.git'], [], [], [], [], ['webpack']], ['webpack', 'webpack', './', '../', {}, ['node_modules'], {}, {}, {
|
|
108
|
-
file: {
|
|
109
|
-
external: ['.js'],
|
|
110
|
-
internal: ['.js']
|
|
111
|
-
}
|
|
112
|
-
}, './', ['.git'], ['node_modules'], ['main'], ['main'], [], [], []], ['webpack', 'webpack', './', '../', {}, ['node_modules'], {}, {}, {
|
|
113
|
-
file: {
|
|
114
|
-
external: ['.js'],
|
|
115
|
-
internal: ['.js']
|
|
116
|
-
}
|
|
117
|
-
}, './', ['.git'], ['node_modules'], ['main'], ['main'], [], [], [], false], [null, 'webpack', './', '../', {}, ['node_modules'], {}, {}, {
|
|
118
|
-
file: {
|
|
119
|
-
external: ['.js'],
|
|
120
|
-
internal: ['.js']
|
|
121
|
-
}
|
|
122
|
-
}, './', ['.git'], ['node_modules'], ['main'], ['main'], [], [], [], true], [null, 'a!webpack', './', '../', {}, ['node_modules'], {}, {}, {
|
|
123
|
-
file: {
|
|
124
|
-
external: ['.js'],
|
|
125
|
-
internal: ['.js']
|
|
126
|
-
}
|
|
127
|
-
}, './', ['.git'], ['node_modules'], ['main'], ['main'], [], [], [], false], [null, 'a!webpack', './', '../', {}, ['node_modules'], {}, {}, {
|
|
128
|
-
file: {
|
|
129
|
-
external: ['.js'],
|
|
130
|
-
internal: ['.js']
|
|
131
|
-
}
|
|
132
|
-
}, './', ['.git'], ['node_modules'], ['main'], ['main'], [], [], [], false, true], ['webpack', 'a!webpack', './', '../', {}, ['node_modules'], {}, {}, {
|
|
133
|
-
file: {
|
|
134
|
-
external: ['.js'],
|
|
135
|
-
internal: ['.js']
|
|
136
|
-
}
|
|
137
|
-
}, './', ['.git'], ['node_modules'], ['main'], ['main'], [], [], [], false, false], [null, 'a!webpack', './', '../', {}, ['node_modules'], {}, {}, {
|
|
138
|
-
file: {
|
|
139
|
-
external: ['.eot'],
|
|
140
|
-
internal: ['.js']
|
|
141
|
-
}
|
|
142
|
-
}, './', ['.git'], ['node_modules'], ['main'], ['main'], [], [], [], false, false]);
|
|
143
|
-
_globals.test.each([[null, './'], ['javaScript', 'a.js'], [null, 'a.css']])("%p === determineAssetType('%s')", function (expected, parameter) {
|
|
144
|
-
var paths = {
|
|
145
|
-
apiDocumentation: '',
|
|
146
|
-
base: '',
|
|
147
|
-
configuration: {
|
|
148
|
-
javaScript: '',
|
|
149
|
-
json: '',
|
|
150
|
-
typeScript: ''
|
|
151
|
-
},
|
|
152
|
-
context: '',
|
|
153
|
-
ignore: [],
|
|
154
|
-
source: {
|
|
155
|
-
asset: {
|
|
156
|
-
base: '',
|
|
157
|
-
cascadingStyleSheet: '',
|
|
158
|
-
data: '',
|
|
159
|
-
font: '',
|
|
160
|
-
image: '',
|
|
161
|
-
javaScript: '',
|
|
162
|
-
template: ''
|
|
163
|
-
},
|
|
164
|
-
base: ''
|
|
165
|
-
},
|
|
166
|
-
target: {
|
|
167
|
-
asset: {
|
|
168
|
-
base: '',
|
|
169
|
-
cascadingStyleSheet: '',
|
|
170
|
-
data: '',
|
|
171
|
-
font: '',
|
|
172
|
-
image: '',
|
|
173
|
-
javaScript: '',
|
|
174
|
-
template: ''
|
|
175
|
-
},
|
|
176
|
-
base: '',
|
|
177
|
-
manifest: '',
|
|
178
|
-
"public": ''
|
|
179
|
-
},
|
|
180
|
-
tidyUp: [],
|
|
181
|
-
tidyUpGlobs: [],
|
|
182
|
-
tidyUpOnClear: [],
|
|
183
|
-
tidyUpOnClearGlobs: []
|
|
184
|
-
};
|
|
185
|
-
(0, _globals.expect)(_helper["default"].determineAssetType(parameter, buildConfiguration, paths)).toStrictEqual(expected);
|
|
186
|
-
});
|
|
187
|
-
(0, _globals.test)('resolveBuildConfigurationFilePaths', function () {
|
|
188
|
-
(0, _globals.expect)(_helper["default"].resolveBuildConfigurationFilePaths({})).toStrictEqual([]);
|
|
189
|
-
(0, _globals.expect)(_helper["default"].resolveBuildConfigurationFilePaths(buildConfiguration, './', ['.git', 'node_modules'])).toStrictEqual([{
|
|
190
|
-
extension: 'js',
|
|
191
|
-
filePathPattern: '',
|
|
192
|
-
filePaths: [],
|
|
193
|
-
ignoredExtension: '',
|
|
194
|
-
outputExtension: 'js'
|
|
195
|
-
}, {
|
|
196
|
-
extension: 'example',
|
|
197
|
-
filePathPattern: '',
|
|
198
|
-
filePaths: [],
|
|
199
|
-
ignoredExtension: '',
|
|
200
|
-
outputExtension: 'example'
|
|
201
|
-
}, {
|
|
202
|
-
extension: 'other',
|
|
203
|
-
filePathPattern: '',
|
|
204
|
-
filePaths: [],
|
|
205
|
-
ignoredExtension: '',
|
|
206
|
-
outputExtension: 'other'
|
|
207
|
-
}]);
|
|
208
|
-
});
|
|
209
|
-
(0, _testHelper.testEach)('determineModuleLocations', _helper["default"].determineModuleLocations, [{
|
|
210
|
-
filePaths: [],
|
|
211
|
-
directoryPaths: []
|
|
212
|
-
}, {}], [{
|
|
213
|
-
filePaths: [],
|
|
214
|
-
directoryPaths: []
|
|
215
|
-
}, 'example'], [{
|
|
216
|
-
directoryPaths: [(0, _path.resolve)(__dirname, '../')],
|
|
217
|
-
filePaths: [(0, _path.resolve)(__dirname, '../helper.js')]
|
|
218
|
-
}, 'helper'], [{
|
|
219
|
-
filePaths: [],
|
|
220
|
-
directoryPaths: []
|
|
221
|
-
}, {
|
|
222
|
-
example: 'example'
|
|
223
|
-
}], [{
|
|
224
|
-
directoryPaths: [(0, _path.resolve)(__dirname, '../')],
|
|
225
|
-
filePaths: [(0, _path.resolve)(__dirname, '../helper.js')]
|
|
226
|
-
}, {
|
|
227
|
-
example: 'helper'
|
|
228
|
-
}], [{
|
|
229
|
-
directoryPaths: [(0, _path.resolve)(__dirname, '../')],
|
|
230
|
-
filePaths: [(0, _path.resolve)(__dirname, '../', 'helper.ts')]
|
|
231
|
-
}, {
|
|
232
|
-
helper: ['helper.ts']
|
|
233
|
-
}]);
|
|
234
|
-
(0, _testHelper.testEach)('resolveModulesInFolders', _helper["default"].resolveModulesInFolders, [{}, {}], [{
|
|
235
|
-
index: []
|
|
236
|
-
}, {
|
|
237
|
-
index: []
|
|
238
|
-
}]);
|
|
239
|
-
(0, _globals.test)('resolveModulesInFolders', function () {
|
|
240
|
-
return (0, _globals.expect)(_helper["default"].resolveModulesInFolders({
|
|
241
|
-
a: [__dirname]
|
|
242
|
-
}).a).toContain('./test/helper.ts');
|
|
243
|
-
});
|
|
244
|
-
(0, _testHelper.testEach)('normalizeGivenInjection', _helper["default"].normalizeGivenInjection, [{
|
|
245
|
-
index: []
|
|
246
|
-
}, []], [{
|
|
247
|
-
index: []
|
|
248
|
-
}, {}], [{
|
|
249
|
-
index: ['example']
|
|
250
|
-
}, 'example'], [{
|
|
251
|
-
index: ['example']
|
|
252
|
-
}, ['example']], [{
|
|
253
|
-
a: ['example']
|
|
254
|
-
}, {
|
|
255
|
-
a: 'example'
|
|
256
|
-
}], [{
|
|
257
|
-
a: ['example']
|
|
258
|
-
}, {
|
|
259
|
-
a: ['example']
|
|
260
|
-
}], [{
|
|
261
|
-
a: ['example']
|
|
262
|
-
}, {
|
|
263
|
-
a: ['example'],
|
|
264
|
-
b: []
|
|
265
|
-
}], [{
|
|
266
|
-
index: []
|
|
267
|
-
}, {
|
|
268
|
-
a: [],
|
|
269
|
-
b: []
|
|
270
|
-
}]);
|
|
271
|
-
(0, _testHelper.testEach)('resolveAutoInjection', _helper["default"].resolveAutoInjection, [{
|
|
272
|
-
autoExclude: [],
|
|
273
|
-
entry: [],
|
|
274
|
-
external: {}
|
|
275
|
-
}, {
|
|
276
|
-
autoExclude: [],
|
|
277
|
-
entry: [],
|
|
278
|
-
external: {}
|
|
279
|
-
}, _helper["default"].resolveBuildConfigurationFilePaths(buildConfiguration, './', ['.git', 'node_modules']), {}, {}, {
|
|
280
|
-
file: {
|
|
281
|
-
external: [],
|
|
282
|
-
internal: []
|
|
283
|
-
}
|
|
284
|
-
}, './', '', ['.git', 'node_modules']], [{
|
|
285
|
-
autoExclude: [],
|
|
286
|
-
entry: 'a.js',
|
|
287
|
-
external: []
|
|
288
|
-
}, {
|
|
289
|
-
autoExclude: [],
|
|
290
|
-
entry: 'a.js',
|
|
291
|
-
external: []
|
|
292
|
-
}, _helper["default"].resolveBuildConfigurationFilePaths(buildConfiguration, './', ['.git', 'node_modules']), {}, {}, {
|
|
293
|
-
file: {
|
|
294
|
-
external: [],
|
|
295
|
-
internal: []
|
|
296
|
-
}
|
|
297
|
-
}, './', '', ['.git', 'node_modules']], [{
|
|
298
|
-
autoExclude: [],
|
|
299
|
-
entry: ['a'],
|
|
300
|
-
external: []
|
|
301
|
-
}, {
|
|
302
|
-
autoExclude: [],
|
|
303
|
-
entry: ['a'],
|
|
304
|
-
external: []
|
|
305
|
-
}, _helper["default"].resolveBuildConfigurationFilePaths(buildConfiguration, './', ['.git', 'node_modules']), {}, {}, {
|
|
306
|
-
file: {
|
|
307
|
-
external: [],
|
|
308
|
-
internal: []
|
|
309
|
-
}
|
|
310
|
-
}, './', '', ['.git', 'node_modules']], [{
|
|
311
|
-
autoExclude: [],
|
|
312
|
-
entry: {},
|
|
313
|
-
external: []
|
|
314
|
-
}, {
|
|
315
|
-
autoExclude: [],
|
|
316
|
-
entry: '__auto__',
|
|
317
|
-
external: []
|
|
318
|
-
}, _helper["default"].resolveBuildConfigurationFilePaths(buildConfiguration, './', ['.git', 'node_modules']), {}, {}, {
|
|
319
|
-
file: {
|
|
320
|
-
external: [],
|
|
321
|
-
internal: []
|
|
322
|
-
}
|
|
323
|
-
}, './', '', ['.git', 'node_modules']], [{
|
|
324
|
-
autoExclude: [],
|
|
325
|
-
entry: {
|
|
326
|
-
index: []
|
|
327
|
-
},
|
|
328
|
-
external: []
|
|
329
|
-
}, {
|
|
330
|
-
autoExclude: [],
|
|
331
|
-
entry: {
|
|
332
|
-
index: '__auto__'
|
|
333
|
-
},
|
|
334
|
-
external: []
|
|
335
|
-
}, _helper["default"].resolveBuildConfigurationFilePaths(buildConfiguration, './', ['.git', 'node_modules']), {}, {}, {
|
|
336
|
-
file: {
|
|
337
|
-
external: [],
|
|
338
|
-
internal: []
|
|
339
|
-
}
|
|
340
|
-
}, './', '', ['.git', 'node_modules']]);
|
|
341
|
-
(0, _globals.test)('getAutoInjection', function () {
|
|
342
|
-
return (0, _globals.expect)(_helper["default"].getAutoInjection(_helper["default"].resolveBuildConfigurationFilePaths(buildConfiguration, './', ['.git', 'node_modules']), ['.git', 'node_modules'], './')).toStrictEqual({});
|
|
343
|
-
});
|
|
344
|
-
(0, _testHelper.testEach)('determineModuleFilePath', _helper["default"].determineModuleFilePath, [null, ''], [null, 'a', {}, {}, {
|
|
345
|
-
file: []
|
|
346
|
-
}, './', '', []], [null, 'a', {
|
|
347
|
-
a: 'b'
|
|
348
|
-
}, {}, {
|
|
349
|
-
file: []
|
|
350
|
-
}, './', '', []], [null, 'bba', {
|
|
351
|
-
a: 'b'
|
|
352
|
-
}, {}, {
|
|
353
|
-
file: []
|
|
354
|
-
}, './', '', []], [(0, _path.resolve)('helper.js'), 'helper'], [null, 'helper', {}, {}, {
|
|
355
|
-
file: []
|
|
356
|
-
}, './', '', []], [null, './helper', {}, {}, {
|
|
357
|
-
file: ['.ts']
|
|
358
|
-
}, '', 'a', []], [(0, _path.resolve)('helper.ts'), 'helper', {}, {}, {
|
|
359
|
-
file: ['.ts']
|
|
360
|
-
}, './', './']);
|
|
361
|
-
/// endregion
|
|
362
|
-
(0, _testHelper.testEach)('applyAliases', _helper["default"].applyAliases, ['', '', {}], ['', '', {
|
|
363
|
-
a: 'b'
|
|
364
|
-
}], ['a', 'a', {}], ['b', 'a', {
|
|
365
|
-
a: 'b'
|
|
366
|
-
}], ['b', 'a', {
|
|
367
|
-
a$: 'b'
|
|
368
|
-
}], ['aa', 'aa', {
|
|
369
|
-
a$: 'b'
|
|
370
|
-
}], ['bbb', 'bba', {
|
|
371
|
-
a: 'b'
|
|
372
|
-
}], ['helper', 'helper', {}]);
|
|
373
|
-
(0, _testHelper.testEach)('applyModuleReplacements', _helper["default"].applyModuleReplacements, ['', '', {}], ['', '', {
|
|
374
|
-
a: 'b'
|
|
375
|
-
}], ['a', 'a', {}], ['b', 'a', {
|
|
376
|
-
a: 'b'
|
|
377
|
-
}], ['b', 'a', {
|
|
378
|
-
a$: 'b'
|
|
379
|
-
}], ['b', 'a', {
|
|
380
|
-
'^a$': 'b'
|
|
381
|
-
}], ['ba', 'aa', {
|
|
382
|
-
a: 'b'
|
|
383
|
-
}], ['helper', 'helper', {}]);
|
|
384
|
-
(0, _testHelper.testEachAgainstSameExpectation)('findPackageDescriptorFilePath', _helper["default"].findPackageDescriptorFilePath, (0, _path.resolve)(__dirname, '../package.json'), ['./', 'package.json'], ['../', 'package.json']);
|
|
385
|
-
_globals.test.each([['./'], ['../']])("getClosestPackageDescriptor('%s') === {configuration: ...}", function (modulePath) {
|
|
386
|
-
var filePath = (0, _path.resolve)(__dirname, '../package.json');
|
|
387
|
-
(0, _globals.expect)(_helper["default"].getClosestPackageDescriptor(modulePath, filePath)).toStrictEqual({
|
|
388
|
-
configuration: (0, _clientnode.currentRequire)(filePath),
|
|
389
|
-
filePath: filePath
|
|
390
|
-
});
|
|
391
|
-
});
|
|
392
|
-
// endregion
|
|
393
|
-
});
|
|
394
|
-
// region vim modline
|
|
395
|
-
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
|
396
|
-
// vim: foldmethod=marker foldmarker=region,endregion:
|
|
397
|
-
// endregion
|
package/test/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// #!/usr/bin/env babel-node
|
|
2
|
-
// -*- coding: utf-8 -*-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
// region imports
|
|
6
|
-
var _globals = require("@jest/globals");
|
|
7
|
-
var _child_process = require("child_process");
|
|
8
|
-
var _fs = require("fs");
|
|
9
|
-
var _path = require("path");
|
|
10
|
-
// endregion
|
|
11
|
-
/*
|
|
12
|
-
NOTE: Theses tasks can take lot longer than 5 seconds (default
|
|
13
|
-
configuration).
|
|
14
|
-
*/
|
|
15
|
-
_globals.jest.setTimeout(60 * 1000);
|
|
16
|
-
var _loop = function _loop() {
|
|
17
|
-
var folder = _arr[_i];
|
|
18
|
-
// Enforce test folder to be handled as dedicated projects via yarn.
|
|
19
|
-
(0, _fs.closeSync)((0, _fs.openSync)((0, _path.resolve)(__dirname, folder, 'yarn.lock'), 'w'));
|
|
20
|
-
(0, _child_process.spawnSync)('yarn', ['install'], {
|
|
21
|
-
cwd: (0, _path.resolve)(__dirname, folder),
|
|
22
|
-
env: process.env,
|
|
23
|
-
shell: true,
|
|
24
|
-
stdio: 'inherit'
|
|
25
|
-
});
|
|
26
|
-
_globals.test.each(['check:types', 'lint', 'build', 'test'])("index (".concat(folder, ":%s)"), function (command) {
|
|
27
|
-
for (var _i2 = 0, _arr2 = ['clear', command, 'clear']; _i2 < _arr2.length; _i2++) {
|
|
28
|
-
var currentCommand = _arr2[_i2];
|
|
29
|
-
(0, _globals.expect)((0, _child_process.spawnSync)('yarn', ['weboptimizer', currentCommand], {
|
|
30
|
-
cwd: (0, _path.resolve)(__dirname, folder),
|
|
31
|
-
env: process.env,
|
|
32
|
-
shell: true,
|
|
33
|
-
stdio: 'inherit'
|
|
34
|
-
}).status).toStrictEqual(0);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
for (var _i = 0, _arr = ['simple', 'scss']; _i < _arr.length; _i++) {
|
|
39
|
-
_loop();
|
|
40
|
-
}
|
|
41
|
-
// region vim modline
|
|
42
|
-
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
|
43
|
-
// vim: foldmethod=marker foldmarker=region,endregion:
|
|
44
|
-
// endregion
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// #!/usr/bin/env babel-node
|
|
2
|
-
// -*- coding: utf-8 -*-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
// region imports
|
|
6
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
7
|
-
var _globals = require("@jest/globals");
|
|
8
|
-
var _stylelintConfigurator = _interopRequireDefault(require("../stylelintConfigurator"));
|
|
9
|
-
// endregion
|
|
10
|
-
(0, _globals.test)('stylelintConfigurator', function () {
|
|
11
|
-
return (0, _globals.expect)(_stylelintConfigurator["default"]).toBeTruthy();
|
|
12
|
-
});
|
|
13
|
-
// region vim modline
|
|
14
|
-
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
|
15
|
-
// vim: foldmethod=marker foldmarker=region,endregion:
|
|
16
|
-
// endregion
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// #!/usr/bin/env babel-node
|
|
2
|
-
// -*- coding: utf-8 -*-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
// region imports
|
|
6
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
7
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _globals = require("@jest/globals");
|
|
11
|
-
var _clientnode = _interopRequireDefault(require("clientnode"));
|
|
12
|
-
var _webpack = _interopRequireDefault(require("webpack"));
|
|
13
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
15
|
-
// endregion
|
|
16
|
-
// Suppress log output.
|
|
17
|
-
console.debug = _clientnode["default"].noop;
|
|
18
|
-
(0, _globals.test)('webpackConfigurator', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
19
|
-
var webpackConfiguration;
|
|
20
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
21
|
-
while (1) switch (_context.prev = _context.next) {
|
|
22
|
-
case 0:
|
|
23
|
-
_context.next = 2;
|
|
24
|
-
return Promise.resolve().then(function () {
|
|
25
|
-
return _interopRequireWildcard(require('../webpackConfigurator'));
|
|
26
|
-
});
|
|
27
|
-
case 2:
|
|
28
|
-
webpackConfiguration = _context.sent["default"];
|
|
29
|
-
(0, _globals.expect)(webpackConfiguration.entry.index).toContain('./index.ts');
|
|
30
|
-
if (!webpackConfiguration.output) webpackConfiguration.output = {};
|
|
31
|
-
webpackConfiguration.output.path = __dirname;
|
|
32
|
-
webpackConfiguration.output.filename = 'dummy.compiled.js';
|
|
33
|
-
(0, _globals.expect)((0, _webpack["default"])(webpackConfiguration)).toBeInstanceOf(Object);
|
|
34
|
-
case 8:
|
|
35
|
-
case "end":
|
|
36
|
-
return _context.stop();
|
|
37
|
-
}
|
|
38
|
-
}, _callee);
|
|
39
|
-
})));
|
|
40
|
-
// region vim modline
|
|
41
|
-
// vim: set tabstop=4 shiftwidth=4 expandtab:
|
|
42
|
-
// vim: foldmethod=marker foldmarker=region,endregion:
|
|
43
|
-
// endregion
|