@rsbuild/webpack 0.0.0-nightly-20231018160828
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/LICENSE +21 -0
- package/README.md +24 -0
- package/compiled/ansi-escapes/index.d.ts +251 -0
- package/compiled/ansi-escapes/index.js +131 -0
- package/compiled/ansi-escapes/license +9 -0
- package/compiled/ansi-escapes/package.json +11 -0
- package/compiled/ansi-escapes/type-fest/index.d.ts +2 -0
- package/compiled/babel-plugin-lodash/index.d.ts +1 -0
- package/compiled/babel-plugin-lodash/index.js +1037 -0
- package/compiled/babel-plugin-lodash/license +44 -0
- package/compiled/babel-plugin-lodash/package.json +7 -0
- package/compiled/babel-plugin-transform-react-remove-prop-types/index.d.ts +1 -0
- package/compiled/babel-plugin-transform-react-remove-prop-types/index.js +565 -0
- package/compiled/babel-plugin-transform-react-remove-prop-types/license +22 -0
- package/compiled/babel-plugin-transform-react-remove-prop-types/package.json +7 -0
- package/compiled/cli-truncate/index.d.ts +96 -0
- package/compiled/cli-truncate/index.js +1388 -0
- package/compiled/cli-truncate/license +9 -0
- package/compiled/cli-truncate/package.json +11 -0
- package/compiled/copy-webpack-plugin/index.d.ts +1 -0
- package/compiled/copy-webpack-plugin/index.js +1160 -0
- package/compiled/copy-webpack-plugin/license +20 -0
- package/compiled/copy-webpack-plugin/package.json +11 -0
- package/compiled/patch-console/build/index.d.ts +4 -0
- package/compiled/patch-console/index.js +70 -0
- package/compiled/patch-console/package.json +11 -0
- package/compiled/schema-utils3/index.d.ts +1 -0
- package/compiled/schema-utils3/index.js +10699 -0
- package/compiled/schema-utils3/license +20 -0
- package/compiled/schema-utils3/package.json +11 -0
- package/compiled/tapable/index.js +1102 -0
- package/compiled/tapable/license +21 -0
- package/compiled/tapable/package.json +7 -0
- package/compiled/tapable/tapable.d.ts +161 -0
- package/compiled/webpack-manifest-plugin/index.js +364 -0
- package/compiled/webpack-manifest-plugin/license +21 -0
- package/compiled/webpack-manifest-plugin/package.json +7 -0
- package/compiled/webpack-manifest-plugin/types/helpers.d.ts +39 -0
- package/compiled/webpack-manifest-plugin/types/hooks.d.ts +44 -0
- package/compiled/webpack-manifest-plugin/types/index.d.ts +34 -0
- package/compiled/webpack-sources/index.d.ts +1 -0
- package/compiled/webpack-sources/index.js +2337 -0
- package/compiled/webpack-sources/license +21 -0
- package/compiled/webpack-sources/package.json +7 -0
- package/dist/config/defaults.d.ts +3 -0
- package/dist/config/defaults.js +56 -0
- package/dist/config/normalize.d.ts +7 -0
- package/dist/config/normalize.js +33 -0
- package/dist/config/validate/dev.d.ts +3 -0
- package/dist/config/validate/dev.js +29 -0
- package/dist/config/validate/experiments.d.ts +3 -0
- package/dist/config/validate/experiments.js +31 -0
- package/dist/config/validate/html.d.ts +3 -0
- package/dist/config/validate/html.js +29 -0
- package/dist/config/validate/index.d.ts +4 -0
- package/dist/config/validate/index.js +52 -0
- package/dist/config/validate/output.d.ts +3 -0
- package/dist/config/validate/output.js +37 -0
- package/dist/config/validate/performance.d.ts +3 -0
- package/dist/config/validate/performance.js +47 -0
- package/dist/config/validate/security.d.ts +4 -0
- package/dist/config/validate/security.js +38 -0
- package/dist/config/validate/source.d.ts +3 -0
- package/dist/config/validate/source.js +34 -0
- package/dist/config/validate/tools.d.ts +3 -0
- package/dist/config/validate/tools.js +58 -0
- package/dist/core/build.d.ts +26 -0
- package/dist/core/build.js +81 -0
- package/dist/core/createCompiler.d.ts +8 -0
- package/dist/core/createCompiler.js +69 -0
- package/dist/core/createContext.d.ts +13 -0
- package/dist/core/createContext.js +60 -0
- package/dist/core/devMiddleware.d.ts +5 -0
- package/dist/core/devMiddleware.js +73 -0
- package/dist/core/initConfigs.d.ts +14 -0
- package/dist/core/initConfigs.js +88 -0
- package/dist/core/initHooks.d.ts +19 -0
- package/dist/core/initHooks.js +44 -0
- package/dist/core/initPlugins.d.ts +9 -0
- package/dist/core/initPlugins.js +83 -0
- package/dist/core/inspectConfig.d.ts +20 -0
- package/dist/core/inspectConfig.js +81 -0
- package/dist/core/startDevServer.d.ts +5 -0
- package/dist/core/startDevServer.js +75 -0
- package/dist/core/webpackConfig.d.ts +9 -0
- package/dist/core/webpackConfig.js +167 -0
- package/dist/exports/HtmlWebpackPlugin.d.ts +2 -0
- package/dist/exports/HtmlWebpackPlugin.js +35 -0
- package/dist/exports/webpack.d.ts +2 -0
- package/dist/exports/webpack.js +35 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +34 -0
- package/dist/plugins/babel.d.ts +3 -0
- package/dist/plugins/babel.js +193 -0
- package/dist/plugins/basic.d.ts +5 -0
- package/dist/plugins/basic.js +60 -0
- package/dist/plugins/copy.d.ts +2 -0
- package/dist/plugins/copy.js +69 -0
- package/dist/plugins/css.d.ts +23 -0
- package/dist/plugins/css.js +124 -0
- package/dist/plugins/fallback.d.ts +2 -0
- package/dist/plugins/fallback.js +51 -0
- package/dist/plugins/hmr.d.ts +2 -0
- package/dist/plugins/hmr.js +41 -0
- package/dist/plugins/lazyCompilation.d.ts +2 -0
- package/dist/plugins/lazyCompilation.js +43 -0
- package/dist/plugins/less.d.ts +6 -0
- package/dist/plugins/less.js +65 -0
- package/dist/plugins/manifest.d.ts +2 -0
- package/dist/plugins/manifest.js +58 -0
- package/dist/plugins/minimize.d.ts +2 -0
- package/dist/plugins/minimize.js +62 -0
- package/dist/plugins/moduleScopes.d.ts +5 -0
- package/dist/plugins/moduleScopes.js +85 -0
- package/dist/plugins/output.d.ts +2 -0
- package/dist/plugins/output.js +67 -0
- package/dist/plugins/progress.d.ts +2 -0
- package/dist/plugins/progress.js +57 -0
- package/dist/plugins/pug.d.ts +2 -0
- package/dist/plugins/pug.js +52 -0
- package/dist/plugins/react.d.ts +2 -0
- package/dist/plugins/react.js +95 -0
- package/dist/plugins/resolve.d.ts +2 -0
- package/dist/plugins/resolve.js +88 -0
- package/dist/plugins/sass.d.ts +2 -0
- package/dist/plugins/sass.js +76 -0
- package/dist/plugins/sri.d.ts +2 -0
- package/dist/plugins/sri.js +43 -0
- package/dist/plugins/tsLoader.d.ts +2 -0
- package/dist/plugins/tsLoader.js +106 -0
- package/dist/provider.d.ts +9 -0
- package/dist/provider.js +104 -0
- package/dist/shared/fs.d.ts +1 -0
- package/dist/shared/fs.js +38 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +22 -0
- package/dist/shared/plugin.d.ts +5 -0
- package/dist/shared/plugin.js +120 -0
- package/dist/types/config/dev.d.ts +3 -0
- package/dist/types/config/dev.js +16 -0
- package/dist/types/config/experiments.d.ts +5 -0
- package/dist/types/config/experiments.js +16 -0
- package/dist/types/config/html.d.ts +3 -0
- package/dist/types/config/html.js +16 -0
- package/dist/types/config/index.d.ts +38 -0
- package/dist/types/config/index.js +36 -0
- package/dist/types/config/output.d.ts +9 -0
- package/dist/types/config/output.js +16 -0
- package/dist/types/config/performance.d.ts +3 -0
- package/dist/types/config/performance.js +16 -0
- package/dist/types/config/security.d.ts +9 -0
- package/dist/types/config/security.js +16 -0
- package/dist/types/config/source.d.ts +35 -0
- package/dist/types/config/source.js +16 -0
- package/dist/types/config/tools.d.ts +71 -0
- package/dist/types/config/tools.js +16 -0
- package/dist/types/context.d.ts +19 -0
- package/dist/types/context.js +16 -0
- package/dist/types/hooks.d.ts +20 -0
- package/dist/types/hooks.js +16 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +30 -0
- package/dist/types/plugin.d.ts +10 -0
- package/dist/types/plugin.js +16 -0
- package/dist/types/thirdParty/CopyWebpackPlugin.d.ts +59 -0
- package/dist/types/thirdParty/CopyWebpackPlugin.js +16 -0
- package/dist/types/thirdParty/css.d.ts +7 -0
- package/dist/types/thirdParty/css.js +16 -0
- package/dist/types/thirdParty/index.d.ts +11 -0
- package/dist/types/thirdParty/index.js +16 -0
- package/dist/webpackLoaders/pugLoader.d.ts +3 -0
- package/dist/webpackLoaders/pugLoader.js +44 -0
- package/dist/webpackPlugins/ModuleScopePlugin.d.ts +16 -0
- package/dist/webpackPlugins/ModuleScopePlugin.js +110 -0
- package/dist/webpackPlugins/ProgressPlugin/ProgressPlugin.d.ts +16 -0
- package/dist/webpackPlugins/ProgressPlugin/ProgressPlugin.js +107 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/bar.d.ts +5 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/bar.js +130 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/bus.d.ts +17 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/bus.js +109 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/index.d.ts +4 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/index.js +28 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/log.d.ts +8 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/log.js +62 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/nonTty.d.ts +15 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/nonTty.js +56 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/percentage.d.ts +7 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/percentage.js +52 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/type.d.ts +23 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/type.js +16 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/utils.d.ts +1 -0
- package/dist/webpackPlugins/ProgressPlugin/helpers/utils.js +30 -0
- package/package.json +68 -0
- package/static/ModuleFilenameHelpers.js +2 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Copyright JS Foundation and other contributors <https://js.foundation/>
|
|
2
|
+
|
|
3
|
+
This software consists of voluntary contributions made by many
|
|
4
|
+
individuals. For exact contribution history, see the revision history
|
|
5
|
+
available at https://github.com/lodash/lodash
|
|
6
|
+
|
|
7
|
+
The following license applies to all parts of this software except as
|
|
8
|
+
documented below:
|
|
9
|
+
|
|
10
|
+
====
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
13
|
+
a copy of this software and associated documentation files (the
|
|
14
|
+
"Software"), to deal in the Software without restriction, including
|
|
15
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
16
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
17
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
18
|
+
the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be
|
|
21
|
+
included in all copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
24
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
25
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
26
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
27
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
28
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
29
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
30
|
+
|
|
31
|
+
====
|
|
32
|
+
|
|
33
|
+
Copyright and related rights for sample code are waived via CC0. Sample
|
|
34
|
+
code is defined as all source code displayed within the prose of the
|
|
35
|
+
documentation.
|
|
36
|
+
|
|
37
|
+
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
|
38
|
+
|
|
39
|
+
====
|
|
40
|
+
|
|
41
|
+
Files located in the node_modules and vendor directories are externally
|
|
42
|
+
maintained libraries used by this software which have their own
|
|
43
|
+
licenses; we recommend you read them, as their terms may differ from the
|
|
44
|
+
terms above.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export = any;
|
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
'use strict';
|
|
3
|
+
var e = {
|
|
4
|
+
13: (e, r) => {
|
|
5
|
+
Object.defineProperty(r, '__esModule', { value: true });
|
|
6
|
+
r['default'] = isAnnotatedForRemoval;
|
|
7
|
+
function isAnnotatedForRemoval(e) {
|
|
8
|
+
var r = e.trailingComments || [];
|
|
9
|
+
return Boolean(
|
|
10
|
+
r.find(function (e) {
|
|
11
|
+
var r = e.value;
|
|
12
|
+
return r.trim() === 'remove-proptypes';
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
551: (e, r) => {
|
|
18
|
+
Object.defineProperty(r, '__esModule', { value: true });
|
|
19
|
+
r['default'] = isStatelessComponent;
|
|
20
|
+
var t = Symbol('traversed');
|
|
21
|
+
function isJSXElementOrReactCreateElement(e) {
|
|
22
|
+
var r = false;
|
|
23
|
+
e.traverse({
|
|
24
|
+
CallExpression: function CallExpression(e) {
|
|
25
|
+
var t = e.get('callee');
|
|
26
|
+
if (
|
|
27
|
+
t.matchesPattern('React.createElement') ||
|
|
28
|
+
t.matchesPattern('React.cloneElement') ||
|
|
29
|
+
t.node.name === 'cloneElement'
|
|
30
|
+
) {
|
|
31
|
+
r = true;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
JSXElement: function JSXElement() {
|
|
35
|
+
r = true;
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
return r;
|
|
39
|
+
}
|
|
40
|
+
function isReturningJSXElement(e) {
|
|
41
|
+
var r =
|
|
42
|
+
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
43
|
+
if (
|
|
44
|
+
e.node.init &&
|
|
45
|
+
e.node.init.body &&
|
|
46
|
+
isJSXElementOrReactCreateElement(e)
|
|
47
|
+
) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
if (r > 20) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
'transform-react-remove-prop-type: infinite loop detected.',
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
var a = false;
|
|
56
|
+
e.traverse({
|
|
57
|
+
ReturnStatement: function ReturnStatement(n) {
|
|
58
|
+
if (a) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
var i = n.get('argument');
|
|
62
|
+
if (!i.node) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (isJSXElementOrReactCreateElement(n)) {
|
|
66
|
+
a = true;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (i.node.type === 'CallExpression') {
|
|
70
|
+
var o = i.get('callee').node.name;
|
|
71
|
+
var s = e.scope.getBinding(o);
|
|
72
|
+
if (!s) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (s.path[t]) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
s.path[t] = true;
|
|
79
|
+
if (isReturningJSXElement(s.path, r + 1)) {
|
|
80
|
+
a = true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
return a;
|
|
86
|
+
}
|
|
87
|
+
var a = ['VariableDeclarator', 'FunctionDeclaration'];
|
|
88
|
+
function isStatelessComponent(e) {
|
|
89
|
+
if (a.indexOf(e.node.type) === -1) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
if (isReturningJSXElement(e)) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
442: (e, r) => {
|
|
99
|
+
Object.defineProperty(r, '__esModule', { value: true });
|
|
100
|
+
r['default'] = remove;
|
|
101
|
+
function isInside(e, r) {
|
|
102
|
+
if (!e.hub.file.opts) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
var t = e.hub.file.opts.filename;
|
|
106
|
+
if (!t) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
if (!r) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return r.test(t);
|
|
113
|
+
}
|
|
114
|
+
function remove(e, r, t) {
|
|
115
|
+
var a = r.visitedKey,
|
|
116
|
+
n = r.unsafeWrapTemplate,
|
|
117
|
+
i = r.wrapTemplate,
|
|
118
|
+
o = r.mode,
|
|
119
|
+
s = r.ignoreFilenames,
|
|
120
|
+
u = r.types;
|
|
121
|
+
if (s && isInside(e.scope, s)) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (e.node[a]) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
e.node[a] = true;
|
|
128
|
+
if (o === 'remove') {
|
|
129
|
+
if (e.parentPath.type === 'ConditionalExpression') {
|
|
130
|
+
e.replaceWith(u.unaryExpression('void', u.numericLiteral(0)));
|
|
131
|
+
} else {
|
|
132
|
+
e.remove();
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (o === 'wrap' || o === 'unsafe-wrap') {
|
|
137
|
+
switch (t.type) {
|
|
138
|
+
case 'createClass':
|
|
139
|
+
break;
|
|
140
|
+
case 'class static': {
|
|
141
|
+
var l;
|
|
142
|
+
var p = t.pathClassDeclaration;
|
|
143
|
+
if (!p.isClassExpression() && p.node.id) {
|
|
144
|
+
l = p.node.id;
|
|
145
|
+
} else {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
var f = u.expressionStatement(
|
|
149
|
+
u.assignmentExpression(
|
|
150
|
+
'=',
|
|
151
|
+
u.memberExpression(l, e.node.key),
|
|
152
|
+
e.node.value,
|
|
153
|
+
),
|
|
154
|
+
);
|
|
155
|
+
if (p.parentPath.isExportDeclaration()) {
|
|
156
|
+
p = p.parentPath;
|
|
157
|
+
}
|
|
158
|
+
p.insertAfter(f);
|
|
159
|
+
e.remove();
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
case 'assign':
|
|
163
|
+
if (o === 'unsafe-wrap') {
|
|
164
|
+
e.replaceWith(n({ NODE: e.node }));
|
|
165
|
+
} else {
|
|
166
|
+
e.replaceWith(i({ LEFT: e.node.left, RIGHT: e.node.right }));
|
|
167
|
+
}
|
|
168
|
+
e.node[a] = true;
|
|
169
|
+
break;
|
|
170
|
+
case 'declarator':
|
|
171
|
+
e.replaceWith(
|
|
172
|
+
i(
|
|
173
|
+
{ LEFT: e.node.id, RIGHT: e.node.init },
|
|
174
|
+
{ as: 'variableDeclarator' },
|
|
175
|
+
),
|
|
176
|
+
);
|
|
177
|
+
e.node[a] = true;
|
|
178
|
+
break;
|
|
179
|
+
default:
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
throw new Error(
|
|
185
|
+
'transform-react-remove-prop-type: unsupported mode '.concat(o, '.'),
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
var r = {};
|
|
191
|
+
function __nccwpck_require__(t) {
|
|
192
|
+
var a = r[t];
|
|
193
|
+
if (a !== undefined) {
|
|
194
|
+
return a.exports;
|
|
195
|
+
}
|
|
196
|
+
var n = (r[t] = { exports: {} });
|
|
197
|
+
var i = true;
|
|
198
|
+
try {
|
|
199
|
+
e[t](n, n.exports, __nccwpck_require__);
|
|
200
|
+
i = false;
|
|
201
|
+
} finally {
|
|
202
|
+
if (i) delete r[t];
|
|
203
|
+
}
|
|
204
|
+
return n.exports;
|
|
205
|
+
}
|
|
206
|
+
if (typeof __nccwpck_require__ !== 'undefined')
|
|
207
|
+
__nccwpck_require__.ab = __dirname + '/';
|
|
208
|
+
var t = {};
|
|
209
|
+
(() => {
|
|
210
|
+
var e = t;
|
|
211
|
+
Object.defineProperty(e, '__esModule', { value: true });
|
|
212
|
+
e['default'] = _default;
|
|
213
|
+
var r = _interopRequireDefault(__nccwpck_require__(13));
|
|
214
|
+
var a = _interopRequireDefault(__nccwpck_require__(551));
|
|
215
|
+
var n = _interopRequireDefault(__nccwpck_require__(442));
|
|
216
|
+
function _interopRequireDefault(e) {
|
|
217
|
+
return e && e.__esModule ? e : { default: e };
|
|
218
|
+
}
|
|
219
|
+
function _objectSpread(e) {
|
|
220
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
221
|
+
var t = arguments[r] != null ? arguments[r] : {};
|
|
222
|
+
var a = Object.keys(t);
|
|
223
|
+
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
224
|
+
a = a.concat(
|
|
225
|
+
Object.getOwnPropertySymbols(t).filter(function (e) {
|
|
226
|
+
return Object.getOwnPropertyDescriptor(t, e).enumerable;
|
|
227
|
+
}),
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
a.forEach(function (r) {
|
|
231
|
+
_defineProperty(e, r, t[r]);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
return e;
|
|
235
|
+
}
|
|
236
|
+
function _defineProperty(e, r, t) {
|
|
237
|
+
if (r in e) {
|
|
238
|
+
Object.defineProperty(e, r, {
|
|
239
|
+
value: t,
|
|
240
|
+
enumerable: true,
|
|
241
|
+
configurable: true,
|
|
242
|
+
writable: true,
|
|
243
|
+
});
|
|
244
|
+
} else {
|
|
245
|
+
e[r] = t;
|
|
246
|
+
}
|
|
247
|
+
return e;
|
|
248
|
+
}
|
|
249
|
+
function isPathReactClass(e, r) {
|
|
250
|
+
var t = e.node;
|
|
251
|
+
var a = r.classNameMatchers;
|
|
252
|
+
if (
|
|
253
|
+
e.matchesPattern('React.Component') ||
|
|
254
|
+
e.matchesPattern('React.PureComponent')
|
|
255
|
+
) {
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
if (t && (t.name === 'Component' || t.name === 'PureComponent')) {
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
if (t && a && a.test(t.name)) {
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
function isReactClass(e, r, t) {
|
|
267
|
+
if (!e.node) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
var a = false;
|
|
271
|
+
if (isPathReactClass(e, t)) {
|
|
272
|
+
a = true;
|
|
273
|
+
} else if (e.node.name) {
|
|
274
|
+
var n = e.node.name;
|
|
275
|
+
var i = r.getBinding(n);
|
|
276
|
+
if (!i) {
|
|
277
|
+
a = false;
|
|
278
|
+
} else {
|
|
279
|
+
var o = i.path.get('superClass');
|
|
280
|
+
if (isPathReactClass(o, t)) {
|
|
281
|
+
a = true;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return a;
|
|
286
|
+
}
|
|
287
|
+
function areSetsEqual(e, r) {
|
|
288
|
+
if (e === r) {
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
if (e.size !== r.size) {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
return !Array.from(e).some(function (e) {
|
|
295
|
+
return !r.has(e);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function memberExpressionRootIdentifier(e) {
|
|
299
|
+
var r = e.findParent(function (e) {
|
|
300
|
+
return !e.isMemberExpression();
|
|
301
|
+
});
|
|
302
|
+
var t = r.node.type;
|
|
303
|
+
var a;
|
|
304
|
+
if (t === 'ObjectProperty') {
|
|
305
|
+
a = r.get('value');
|
|
306
|
+
}
|
|
307
|
+
if (!a || a.type !== 'MemberExpression') {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
while (a.node.object.type === 'MemberExpression') {
|
|
311
|
+
a = a.get('object');
|
|
312
|
+
}
|
|
313
|
+
return a.get('object');
|
|
314
|
+
}
|
|
315
|
+
function _default(e) {
|
|
316
|
+
var t = e.template,
|
|
317
|
+
i = e.types,
|
|
318
|
+
o = e.traverse;
|
|
319
|
+
var s = new Set();
|
|
320
|
+
var u = new WeakSet();
|
|
321
|
+
var l = {
|
|
322
|
+
Identifier: function Identifier(e) {
|
|
323
|
+
if (e.parent.type === 'MemberExpression') {
|
|
324
|
+
var r = memberExpressionRootIdentifier(e);
|
|
325
|
+
if (r) {
|
|
326
|
+
s.add(r.node.name);
|
|
327
|
+
}
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
if (
|
|
331
|
+
e.parent.type === 'ObjectProperty' &&
|
|
332
|
+
(e.parent.key === e.node || e.parent.shorthand)
|
|
333
|
+
) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
s.add(e.node.name);
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
return {
|
|
340
|
+
visitor: {
|
|
341
|
+
Program: function Program(p, f) {
|
|
342
|
+
var c;
|
|
343
|
+
var d;
|
|
344
|
+
if (f.opts.ignoreFilenames) {
|
|
345
|
+
c = new RegExp(f.opts.ignoreFilenames.join('|'), 'i');
|
|
346
|
+
} else {
|
|
347
|
+
c = undefined;
|
|
348
|
+
}
|
|
349
|
+
if (f.opts.classNameMatchers) {
|
|
350
|
+
d = new RegExp(f.opts.classNameMatchers.join('|'));
|
|
351
|
+
} else {
|
|
352
|
+
d = undefined;
|
|
353
|
+
}
|
|
354
|
+
var m = {
|
|
355
|
+
visitedKey: 'transform-react-remove-prop-types'.concat(
|
|
356
|
+
Date.now(),
|
|
357
|
+
),
|
|
358
|
+
unsafeWrapTemplate: t(
|
|
359
|
+
'\n if (process.env.NODE_ENV !== "production") {\n NODE;\n }\n ',
|
|
360
|
+
{ placeholderPattern: /^NODE$/ },
|
|
361
|
+
),
|
|
362
|
+
wrapTemplate: function wrapTemplate(e) {
|
|
363
|
+
var r = e.LEFT,
|
|
364
|
+
a = e.RIGHT;
|
|
365
|
+
var n =
|
|
366
|
+
arguments.length > 1 && arguments[1] !== undefined
|
|
367
|
+
? arguments[1]
|
|
368
|
+
: {};
|
|
369
|
+
var o = n.as,
|
|
370
|
+
s = o === void 0 ? 'assignmentExpression' : o;
|
|
371
|
+
var u = t.expression(
|
|
372
|
+
'\n process.env.NODE_ENV !== "production" ? RIGHT : {}\n ',
|
|
373
|
+
{ placeholderPattern: /^(LEFT|RIGHT)$/ },
|
|
374
|
+
)({ RIGHT: a });
|
|
375
|
+
switch (s) {
|
|
376
|
+
case 'variableDeclarator':
|
|
377
|
+
return i.variableDeclarator(r, u);
|
|
378
|
+
case 'assignmentExpression':
|
|
379
|
+
return i.assignmentExpression('=', r, u);
|
|
380
|
+
default:
|
|
381
|
+
throw new Error('unrecognized template type '.concat(s));
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
mode: f.opts.mode || 'remove',
|
|
385
|
+
ignoreFilenames: c,
|
|
386
|
+
types: i,
|
|
387
|
+
removeImport: f.opts.removeImport || false,
|
|
388
|
+
libraries: (f.opts.additionalLibraries || []).concat(
|
|
389
|
+
'prop-types',
|
|
390
|
+
),
|
|
391
|
+
classNameMatchers: d,
|
|
392
|
+
createReactClassName:
|
|
393
|
+
f.opts.createReactClassName || 'createReactClass',
|
|
394
|
+
};
|
|
395
|
+
if (f.opts.plugins) {
|
|
396
|
+
var v = f;
|
|
397
|
+
var y = f.opts.plugins.map(function (r) {
|
|
398
|
+
var t = typeof r === 'string' ? r : r[0];
|
|
399
|
+
if (typeof r !== 'string') {
|
|
400
|
+
v.opts = _objectSpread({}, v.opts, r[1]);
|
|
401
|
+
}
|
|
402
|
+
var a = require(t);
|
|
403
|
+
if (typeof a !== 'function') {
|
|
404
|
+
a = a.default;
|
|
405
|
+
}
|
|
406
|
+
return a(e).visitor;
|
|
407
|
+
});
|
|
408
|
+
o(p.parent, o.visitors.merge(y), p.scope, v, p.parentPath);
|
|
409
|
+
}
|
|
410
|
+
p.traverse({
|
|
411
|
+
ObjectProperty: {
|
|
412
|
+
exit: function exit(e) {
|
|
413
|
+
var r = e.node;
|
|
414
|
+
if (r.computed || r.key.name !== 'propTypes') {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
var t = e.findParent(function (e) {
|
|
418
|
+
if (e.type !== 'CallExpression') {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
return (
|
|
422
|
+
e.get('callee').node.name === m.createReactClassName ||
|
|
423
|
+
(e.get('callee').node.property &&
|
|
424
|
+
e.get('callee').node.property.name === 'createClass')
|
|
425
|
+
);
|
|
426
|
+
});
|
|
427
|
+
if (t) {
|
|
428
|
+
e.traverse(l);
|
|
429
|
+
u.add(e);
|
|
430
|
+
(0, n.default)(e, m, { type: 'createClass' });
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
ClassProperty: function ClassProperty(e) {
|
|
435
|
+
var r = e.node,
|
|
436
|
+
t = e.scope;
|
|
437
|
+
if (r.key.name === 'propTypes') {
|
|
438
|
+
var a = t.path;
|
|
439
|
+
if (isReactClass(a.get('superClass'), t, m)) {
|
|
440
|
+
e.traverse(l);
|
|
441
|
+
u.add(e);
|
|
442
|
+
(0, n.default)(e, m, {
|
|
443
|
+
type: 'class static',
|
|
444
|
+
pathClassDeclaration: a,
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
AssignmentExpression: function AssignmentExpression(e) {
|
|
450
|
+
var t = e.node,
|
|
451
|
+
i = e.scope;
|
|
452
|
+
if (
|
|
453
|
+
t.left.computed ||
|
|
454
|
+
!t.left.property ||
|
|
455
|
+
t.left.property.name !== 'propTypes'
|
|
456
|
+
) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
var o = (0, r.default)(e.node.left);
|
|
460
|
+
if (o) {
|
|
461
|
+
e.traverse(l);
|
|
462
|
+
u.add(e);
|
|
463
|
+
(0, n.default)(e, m, { type: 'assign' });
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
var s = t.left.object.name;
|
|
467
|
+
var p = i.getBinding(s);
|
|
468
|
+
if (!p) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
if (p.path.isClassDeclaration()) {
|
|
472
|
+
var f = p.path.get('superClass');
|
|
473
|
+
if (isReactClass(f, i, m)) {
|
|
474
|
+
e.traverse(l);
|
|
475
|
+
u.add(e);
|
|
476
|
+
(0, n.default)(e, m, { type: 'assign' });
|
|
477
|
+
}
|
|
478
|
+
} else if ((0, a.default)(p.path)) {
|
|
479
|
+
e.traverse(l);
|
|
480
|
+
u.add(e);
|
|
481
|
+
(0, n.default)(e, m, { type: 'assign' });
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
});
|
|
485
|
+
var g = 0;
|
|
486
|
+
var b = {
|
|
487
|
+
VariableDeclarator: function VariableDeclarator(e) {
|
|
488
|
+
if (e.scope.block.type !== 'Program') {
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (
|
|
492
|
+
['ObjectPattern', 'ArrayPattern'].includes(e.node.id.type)
|
|
493
|
+
) {
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
var r = e.node.id.name;
|
|
497
|
+
if (!s.has(r)) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
var t = e.scope.getBinding(r),
|
|
501
|
+
a = t.referencePaths;
|
|
502
|
+
var i = a.some(function (e) {
|
|
503
|
+
var r = e.find(function (e) {
|
|
504
|
+
return u.has(e);
|
|
505
|
+
});
|
|
506
|
+
return !r;
|
|
507
|
+
});
|
|
508
|
+
if (i) {
|
|
509
|
+
g += 1;
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
u.add(e);
|
|
513
|
+
s.delete(r);
|
|
514
|
+
e.get('init').traverse(l);
|
|
515
|
+
(0, n.default)(e, m, { type: 'declarator' });
|
|
516
|
+
},
|
|
517
|
+
};
|
|
518
|
+
var _ = new Set();
|
|
519
|
+
while (!areSetsEqual(s, _) && s.size > 0 && g < s.size) {
|
|
520
|
+
_ = new Set(s);
|
|
521
|
+
g = 0;
|
|
522
|
+
p.scope.crawl();
|
|
523
|
+
p.traverse(b);
|
|
524
|
+
}
|
|
525
|
+
if (m.removeImport) {
|
|
526
|
+
if (m.mode === 'remove') {
|
|
527
|
+
p.scope.crawl();
|
|
528
|
+
p.traverse({
|
|
529
|
+
ImportDeclaration: function ImportDeclaration(e) {
|
|
530
|
+
var r = e.node,
|
|
531
|
+
t = r.source,
|
|
532
|
+
a = r.specifiers;
|
|
533
|
+
var n = m.libraries.some(function (e) {
|
|
534
|
+
if (e instanceof RegExp) {
|
|
535
|
+
return e.test(t.value);
|
|
536
|
+
}
|
|
537
|
+
return t.value === e;
|
|
538
|
+
});
|
|
539
|
+
if (!n) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
var i = a.some(function (r) {
|
|
543
|
+
var t = r.local.name;
|
|
544
|
+
var a = e.scope.getBinding(t),
|
|
545
|
+
n = a.referencePaths;
|
|
546
|
+
return n.length > 0;
|
|
547
|
+
});
|
|
548
|
+
if (!i) {
|
|
549
|
+
e.remove();
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
});
|
|
553
|
+
} else {
|
|
554
|
+
throw new Error(
|
|
555
|
+
'transform-react-remove-prop-type: removeImport = true and mode != "remove" can not be used at the same time.',
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
})();
|
|
564
|
+
module.exports = t;
|
|
565
|
+
})();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Nikita Gusakov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|