@gravityforms/dependency-extraction-webpack-plugin 4.5.0-beta.1
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/README.md +47 -0
- package/assets/get-packages.js +88 -0
- package/assets/utils.js +12 -0
- package/index.js +1 -0
- package/mappings/components/admin.js +584 -0
- package/package.json +36 -0
- package/src/index.js +81 -0
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Gravity Forms Dependency Extraction Webpack Plugin
|
|
2
|
+
|
|
3
|
+
This plugin enhances the WordPress [Dependency Extraction Webpack Plugin](https://github.com/WordPress/gutenberg/tree/trunk/packages/dependency-extraction-webpack-plugin) by adding automatic inclusion of Gravity Forms dependencies alongside WordPress dependencies. Use this if you are developing features or addons that extend Gravity Forms and want to use our externals instead of bundling our code yourselves. Also used by the Gravity Forms plugin itself.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
To install the module, use the following command:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @gravityforms/dependency-extraction-webpack-plugin --save-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Integrate this plugin just like you would with the [Dependency Extraction Webpack Plugin](https://github.com/WordPress/gutenberg/tree/trunk/packages/dependency-extraction-webpack-plugin). The API remains identical, except for a few custom options we have added listed below, but it now also processes Gravity Forms packages automatically.
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const GravityFormsDependencyExtractionWebpackPlugin = require('@gravityforms/dependency-extraction-webpack-plugin');
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
// other webpack config
|
|
22
|
+
plugins: [new GravityFormsDependencyExtractionWebpackPlugin()],
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Options
|
|
27
|
+
|
|
28
|
+
You can pass an object to the constructor to modify the plugin's behavior, for instance:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
module.exports = {
|
|
32
|
+
plugins: [
|
|
33
|
+
new GravityFormsDependencyExtractionWebpackPlugin({
|
|
34
|
+
bundledPackages: ['@gravityforms/libraries'],
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### `bundledPackages`
|
|
41
|
+
|
|
42
|
+
- Type: array
|
|
43
|
+
- Default: []
|
|
44
|
+
|
|
45
|
+
This option specifies an array of potential Gravity Forms excluded packages. These packages will be included within the bundle (as shown in the example above) and not mapped to the external.
|
|
46
|
+
|
|
47
|
+
For more configuration options, refer to the original [dependency extraction plugin](https://github.com/WordPress/gutenberg/blob/trunk/packages/dependency-extraction-webpack-plugin/README.md#options).
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const fs = require( 'fs' );
|
|
2
|
+
const path = require( 'path' );
|
|
3
|
+
const { trailingSlashIt, untrailingSlashIt } = require( './utils' );
|
|
4
|
+
|
|
5
|
+
const GF_NAMESPACE = '@gravityforms';
|
|
6
|
+
const COMPONENTS_NAMESPACE = `${ GF_NAMESPACE }/components`;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Load mappings from a file if it exists.
|
|
10
|
+
* @param {string} mappingsPath - Path to the mappings file.
|
|
11
|
+
* @param {string} defaultPath - Path to the default mappings file.
|
|
12
|
+
* @returns {Array} - Array of component mappings.
|
|
13
|
+
*/
|
|
14
|
+
const loadMappings = ( mappingsPath, defaultPath ) => {
|
|
15
|
+
try {
|
|
16
|
+
if ( fs.existsSync( mappingsPath ) ) {
|
|
17
|
+
return require( mappingsPath );
|
|
18
|
+
} else if ( fs.existsSync( defaultPath ) ) {
|
|
19
|
+
return require( defaultPath );
|
|
20
|
+
}
|
|
21
|
+
return [];
|
|
22
|
+
} catch ( error ) {
|
|
23
|
+
console.error( `Error loading mappings from ${ mappingsPath }:`, error );
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create package entry for a component.
|
|
30
|
+
* @param {string} rootNamespace - Root namespace for the component.
|
|
31
|
+
* @param {Object} component - Component mapping object.
|
|
32
|
+
* @param {Object} packages - Packages object to store the results.
|
|
33
|
+
*/
|
|
34
|
+
const createComponentPackageEntry = ( rootNamespace, component, packages ) => {
|
|
35
|
+
const { defaultExport = '', namedExports = [], externalPath = '', importPath = '' } = component;
|
|
36
|
+
|
|
37
|
+
// There's a problem with the map source for this component
|
|
38
|
+
if ( ! defaultExport && ! namedExports.length ) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// We don't bundle svgs currently, may create new package down the road
|
|
42
|
+
if ( importPath.includes( 'elements/Svgs' ) ) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const importPathParts = untrailingSlashIt( importPath ).split( '/' );
|
|
47
|
+
const externalParts = externalPath.split( '.' );
|
|
48
|
+
|
|
49
|
+
if ( importPathParts.length === 4 ) {
|
|
50
|
+
externalParts.push( importPathParts[ 3 ] );
|
|
51
|
+
}
|
|
52
|
+
externalParts.push( defaultExport );
|
|
53
|
+
|
|
54
|
+
packages[ `${ COMPONENTS_NAMESPACE }/${ trailingSlashIt( importPath ) }${ defaultExport }` ] = {
|
|
55
|
+
external: [ rootNamespace, ...externalParts ],
|
|
56
|
+
handle: `${ rootNamespace }_gravityforms_${ importPathParts[ 1 ] }_components`,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get packages based on the component mappings.
|
|
62
|
+
* @param {string} rootNamespace - Root namespace for the packages.
|
|
63
|
+
* @returns {Object} - Packages object.
|
|
64
|
+
*/
|
|
65
|
+
const getPackages = ( rootNamespace ) => {
|
|
66
|
+
// add new basic external packages here
|
|
67
|
+
const packages = {
|
|
68
|
+
[ `${ GF_NAMESPACE }/libraries` ]: { external: [ rootNamespace, 'libraries' ], handle: `${ rootNamespace }_gravityforms_libraries` },
|
|
69
|
+
[ `${ GF_NAMESPACE }/react-utils` ]: { external: [ rootNamespace, 'utils', 'react' ], handle: `${ rootNamespace }_gravityforms_react_utils` },
|
|
70
|
+
[ `${ GF_NAMESPACE }/utils` ]: { external: [ rootNamespace, 'utils' ], handle: `${ rootNamespace }_gravityforms_utils` },
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const adminComponentMappings = loadMappings(
|
|
74
|
+
path.resolve( __dirname, '../../components/dist/mappings/admin.js' ),
|
|
75
|
+
path.resolve( __dirname, '../mappings/components/admin.js' )
|
|
76
|
+
);
|
|
77
|
+
const themeComponentMappings = loadMappings(
|
|
78
|
+
path.resolve( __dirname, '../../components/dist/mappings/theme.js' ),
|
|
79
|
+
path.resolve( __dirname, '../mappings/components/theme.js' )
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const componentMappings = [ ...adminComponentMappings, ...themeComponentMappings ];
|
|
83
|
+
componentMappings.forEach( ( component ) => createComponentPackageEntry( rootNamespace, component, packages ) );
|
|
84
|
+
|
|
85
|
+
return packages;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
module.exports = getPackages;
|
package/assets/utils.js
ADDED
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
module.exports = [
|
|
2
|
+
{
|
|
3
|
+
"defaultExport": "Table",
|
|
4
|
+
"importPath": "html/admin/modules/",
|
|
5
|
+
"externalPath": "components.admin.html.modules"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"defaultExport": "Flyout",
|
|
9
|
+
"namedExports": [
|
|
10
|
+
"flyoutTemplate"
|
|
11
|
+
],
|
|
12
|
+
"importPath": "html/admin/modules/",
|
|
13
|
+
"externalPath": "components.admin.html.modules"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"defaultExport": "Dialog",
|
|
17
|
+
"namedExports": [
|
|
18
|
+
"dialogTemplate"
|
|
19
|
+
],
|
|
20
|
+
"importPath": "html/admin/modules/",
|
|
21
|
+
"externalPath": "components.admin.html.modules"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"defaultExport": "Toggle",
|
|
25
|
+
"namedExports": [
|
|
26
|
+
"toggleTemplate"
|
|
27
|
+
],
|
|
28
|
+
"importPath": "html/admin/elements/",
|
|
29
|
+
"externalPath": "components.admin.html.elements"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"defaultExport": "Text",
|
|
33
|
+
"namedExports": [
|
|
34
|
+
"textTemplate"
|
|
35
|
+
],
|
|
36
|
+
"importPath": "html/admin/elements/",
|
|
37
|
+
"externalPath": "components.admin.html.elements"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"defaultExport": "Textarea",
|
|
41
|
+
"namedExports": [
|
|
42
|
+
"textareaTemplate"
|
|
43
|
+
],
|
|
44
|
+
"importPath": "html/admin/elements/",
|
|
45
|
+
"externalPath": "components.admin.html.elements"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"defaultExport": "StatusIndicator",
|
|
49
|
+
"namedExports": [
|
|
50
|
+
"statusIndicatorTemplate"
|
|
51
|
+
],
|
|
52
|
+
"importPath": "html/admin/elements/",
|
|
53
|
+
"externalPath": "components.admin.html.elements"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"defaultExport": "Link",
|
|
57
|
+
"namedExports": [
|
|
58
|
+
"linkTemplate"
|
|
59
|
+
],
|
|
60
|
+
"importPath": "html/admin/elements/",
|
|
61
|
+
"externalPath": "components.admin.html.elements"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"defaultExport": "Select",
|
|
65
|
+
"namedExports": [
|
|
66
|
+
"selectTemplate"
|
|
67
|
+
],
|
|
68
|
+
"importPath": "html/admin/elements/",
|
|
69
|
+
"externalPath": "components.admin.html.elements"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"defaultExport": "StackedIcon",
|
|
73
|
+
"namedExports": [
|
|
74
|
+
"stackedIconTemplate"
|
|
75
|
+
],
|
|
76
|
+
"importPath": "html/admin/elements/",
|
|
77
|
+
"externalPath": "components.admin.html.elements"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"defaultExport": "Loader",
|
|
81
|
+
"namedExports": [
|
|
82
|
+
"loaderTemplate"
|
|
83
|
+
],
|
|
84
|
+
"importPath": "html/admin/elements/",
|
|
85
|
+
"externalPath": "components.admin.html.elements"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"defaultExport": "Input",
|
|
89
|
+
"namedExports": [
|
|
90
|
+
"inputTemplate"
|
|
91
|
+
],
|
|
92
|
+
"importPath": "html/admin/elements/",
|
|
93
|
+
"externalPath": "components.admin.html.elements"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"defaultExport": "Label",
|
|
97
|
+
"namedExports": [
|
|
98
|
+
"labelTemplate"
|
|
99
|
+
],
|
|
100
|
+
"importPath": "html/admin/elements/",
|
|
101
|
+
"externalPath": "components.admin.html.elements"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"defaultExport": "HelpText",
|
|
105
|
+
"namedExports": [
|
|
106
|
+
"helpTextTemplate"
|
|
107
|
+
],
|
|
108
|
+
"importPath": "html/admin/elements/",
|
|
109
|
+
"externalPath": "components.admin.html.elements"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"defaultExport": "Heading",
|
|
113
|
+
"namedExports": [
|
|
114
|
+
"headingTemplate"
|
|
115
|
+
],
|
|
116
|
+
"importPath": "html/admin/elements/",
|
|
117
|
+
"externalPath": "components.admin.html.elements"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"defaultExport": "Button",
|
|
121
|
+
"namedExports": [
|
|
122
|
+
"buttonTemplate"
|
|
123
|
+
],
|
|
124
|
+
"importPath": "html/admin/elements/",
|
|
125
|
+
"externalPath": "components.admin.html.elements"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"defaultExport": "Dropdown",
|
|
129
|
+
"namedExports": [
|
|
130
|
+
"dropdownTemplate",
|
|
131
|
+
"dropdownListItems"
|
|
132
|
+
],
|
|
133
|
+
"importPath": "html/admin/elements/",
|
|
134
|
+
"externalPath": "components.admin.html.elements"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"defaultExport": "Alert",
|
|
138
|
+
"namedExports": [
|
|
139
|
+
"alertTemplate"
|
|
140
|
+
],
|
|
141
|
+
"importPath": "html/admin/elements/",
|
|
142
|
+
"externalPath": "components.admin.html.elements"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"defaultExport": "Tooltip",
|
|
146
|
+
"importPath": "react/admin/modules/",
|
|
147
|
+
"externalPath": "components.admin.react.modules"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"defaultExport": "Swatch",
|
|
151
|
+
"importPath": "react/admin/modules/",
|
|
152
|
+
"externalPath": "components.admin.react.modules"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"defaultExport": "Steps",
|
|
156
|
+
"importPath": "react/admin/modules/",
|
|
157
|
+
"externalPath": "components.admin.react.modules"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"defaultExport": "SnackBar",
|
|
161
|
+
"importPath": "react/admin/modules/",
|
|
162
|
+
"externalPath": "components.admin.react.modules"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"defaultExport": "Pagination",
|
|
166
|
+
"importPath": "react/admin/modules/",
|
|
167
|
+
"externalPath": "components.admin.react.modules"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"defaultExport": "RouterNavBar",
|
|
171
|
+
"importPath": "react/admin/modules/",
|
|
172
|
+
"externalPath": "components.admin.react.modules"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"defaultExport": "NavBar",
|
|
176
|
+
"importPath": "react/admin/modules/",
|
|
177
|
+
"externalPath": "components.admin.react.modules"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"defaultExport": "MetaBox",
|
|
181
|
+
"importPath": "react/admin/modules/",
|
|
182
|
+
"externalPath": "components.admin.react.modules"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"defaultExport": "List",
|
|
186
|
+
"importPath": "react/admin/modules/",
|
|
187
|
+
"externalPath": "components.admin.react.modules"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"defaultExport": "Gravatar",
|
|
191
|
+
"importPath": "react/admin/modules/",
|
|
192
|
+
"externalPath": "components.admin.react.modules"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"defaultExport": "InputGroup",
|
|
196
|
+
"importPath": "react/admin/modules/",
|
|
197
|
+
"externalPath": "components.admin.react.modules"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"defaultExport": "Flyout",
|
|
201
|
+
"importPath": "react/admin/modules/",
|
|
202
|
+
"externalPath": "components.admin.react.modules"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"defaultExport": "Droplist",
|
|
206
|
+
"importPath": "react/admin/modules/",
|
|
207
|
+
"externalPath": "components.admin.react.modules"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"defaultExport": "Dropdown",
|
|
211
|
+
"importPath": "react/admin/modules/",
|
|
212
|
+
"externalPath": "components.admin.react.modules"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"defaultExport": "ColorPicker",
|
|
216
|
+
"importPath": "react/admin/modules/",
|
|
217
|
+
"externalPath": "components.admin.react.modules"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"defaultExport": "DataGrid",
|
|
221
|
+
"importPath": "react/admin/modules/",
|
|
222
|
+
"externalPath": "components.admin.react.modules"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"defaultExport": "Alert",
|
|
226
|
+
"importPath": "react/admin/modules/",
|
|
227
|
+
"externalPath": "components.admin.react.modules"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"defaultExport": "Calendar",
|
|
231
|
+
"importPath": "react/admin/modules/",
|
|
232
|
+
"externalPath": "components.admin.react.modules"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"defaultExport": "Toggle",
|
|
236
|
+
"importPath": "react/admin/elements/",
|
|
237
|
+
"externalPath": "components.admin.react.elements"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"defaultExport": "Textarea",
|
|
241
|
+
"importPath": "react/admin/elements/",
|
|
242
|
+
"externalPath": "components.admin.react.elements"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"defaultExport": "Text",
|
|
246
|
+
"importPath": "react/admin/elements/",
|
|
247
|
+
"externalPath": "components.admin.react.elements"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"defaultExport": "Tag",
|
|
251
|
+
"importPath": "react/admin/elements/",
|
|
252
|
+
"externalPath": "components.admin.react.elements"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"defaultExport": "StatusIndicator",
|
|
256
|
+
"importPath": "react/admin/elements/",
|
|
257
|
+
"externalPath": "components.admin.react.elements"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"defaultExport": "Dialog",
|
|
261
|
+
"importPath": "react/admin/modules/",
|
|
262
|
+
"externalPath": "components.admin.react.modules"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"defaultExport": "Select",
|
|
266
|
+
"importPath": "react/admin/elements/",
|
|
267
|
+
"externalPath": "components.admin.react.elements"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"defaultExport": "Range",
|
|
271
|
+
"importPath": "react/admin/elements/",
|
|
272
|
+
"externalPath": "components.admin.react.elements"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"defaultExport": "Pill",
|
|
276
|
+
"importPath": "react/admin/elements/",
|
|
277
|
+
"externalPath": "components.admin.react.elements"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"defaultExport": "Radio",
|
|
281
|
+
"importPath": "react/admin/elements/",
|
|
282
|
+
"externalPath": "components.admin.react.elements"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"defaultExport": "Link",
|
|
286
|
+
"importPath": "react/admin/elements/",
|
|
287
|
+
"externalPath": "components.admin.react.elements"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"defaultExport": "Label",
|
|
291
|
+
"importPath": "react/admin/elements/",
|
|
292
|
+
"externalPath": "components.admin.react.elements"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"defaultExport": "Input",
|
|
296
|
+
"importPath": "react/admin/elements/",
|
|
297
|
+
"externalPath": "components.admin.react.elements"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"defaultExport": "Image",
|
|
301
|
+
"importPath": "react/admin/elements/",
|
|
302
|
+
"externalPath": "components.admin.react.elements"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"defaultExport": "Icon",
|
|
306
|
+
"importPath": "react/admin/elements/",
|
|
307
|
+
"externalPath": "components.admin.react.elements"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"defaultExport": "HelpText",
|
|
311
|
+
"importPath": "react/admin/elements/",
|
|
312
|
+
"externalPath": "components.admin.react.elements"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"defaultExport": "Grid",
|
|
316
|
+
"importPath": "react/admin/elements/",
|
|
317
|
+
"externalPath": "components.admin.react.elements"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"defaultExport": "Heading",
|
|
321
|
+
"importPath": "react/admin/elements/",
|
|
322
|
+
"externalPath": "components.admin.react.elements"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"defaultExport": "FileUpload",
|
|
326
|
+
"importPath": "react/admin/elements/",
|
|
327
|
+
"externalPath": "components.admin.react.elements"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"defaultExport": "DescriptionList",
|
|
331
|
+
"importPath": "react/admin/elements/",
|
|
332
|
+
"externalPath": "components.admin.react.elements"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"defaultExport": "Checkbox",
|
|
336
|
+
"importPath": "react/admin/elements/",
|
|
337
|
+
"externalPath": "components.admin.react.elements"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"defaultExport": "Button",
|
|
341
|
+
"importPath": "react/admin/elements/",
|
|
342
|
+
"externalPath": "components.admin.react.elements"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"defaultExport": "Box",
|
|
346
|
+
"importPath": "react/admin/elements/",
|
|
347
|
+
"externalPath": "components.admin.react.elements"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"defaultExport": "RingLoader",
|
|
351
|
+
"importPath": "react/admin/modules/Loaders/",
|
|
352
|
+
"externalPath": "components.admin.react.modules"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
"defaultExport": "VidyardVideo",
|
|
356
|
+
"importPath": "react/admin/modules/Videos/",
|
|
357
|
+
"externalPath": "components.admin.react.modules"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"defaultExport": "ModularSidebar",
|
|
361
|
+
"importPath": "react/admin/modules/Layouts/",
|
|
362
|
+
"externalPath": "components.admin.react.modules"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"defaultExport": "RightSidebar",
|
|
366
|
+
"importPath": "react/admin/modules/Layouts/",
|
|
367
|
+
"externalPath": "components.admin.react.modules"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"defaultExport": "DotIndicator",
|
|
371
|
+
"importPath": "react/admin/modules/Indicators/",
|
|
372
|
+
"externalPath": "components.admin.react.modules"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"defaultExport": "IconIndicator",
|
|
376
|
+
"importPath": "react/admin/modules/Indicators/",
|
|
377
|
+
"externalPath": "components.admin.react.modules"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"defaultExport": "IntegrationCard",
|
|
381
|
+
"importPath": "react/admin/modules/Cards/",
|
|
382
|
+
"externalPath": "components.admin.react.modules"
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"defaultExport": "FormTemplateCard",
|
|
386
|
+
"importPath": "react/admin/modules/Cards/",
|
|
387
|
+
"externalPath": "components.admin.react.modules"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"defaultExport": "WordPressLogo",
|
|
391
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
392
|
+
"externalPath": "components.admin.react.elements"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"defaultExport": "WhatsAppLogo",
|
|
396
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
397
|
+
"externalPath": "components.admin.react.elements"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"defaultExport": "ZohoLogo",
|
|
401
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
402
|
+
"externalPath": "components.admin.react.elements"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"defaultExport": "TelegramLogo",
|
|
406
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
407
|
+
"externalPath": "components.admin.react.elements"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"defaultExport": "TwilioLogo",
|
|
411
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
412
|
+
"externalPath": "components.admin.react.elements"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"defaultExport": "SparkPostLogo",
|
|
416
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
417
|
+
"externalPath": "components.admin.react.elements"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"defaultExport": "SendGridFullLogo",
|
|
421
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
422
|
+
"externalPath": "components.admin.react.elements"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"defaultExport": "SendGridLogo",
|
|
426
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
427
|
+
"externalPath": "components.admin.react.elements"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"defaultExport": "SearchNoResults",
|
|
431
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
432
|
+
"externalPath": "components.admin.react.elements"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"defaultExport": "SlackLogo",
|
|
436
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
437
|
+
"externalPath": "components.admin.react.elements"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"defaultExport": "SMTP2GOLogo",
|
|
441
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
442
|
+
"externalPath": "components.admin.react.elements"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"defaultExport": "PostmarkLogo",
|
|
446
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
447
|
+
"externalPath": "components.admin.react.elements"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"defaultExport": "PostmarkFullLogo",
|
|
451
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
452
|
+
"externalPath": "components.admin.react.elements"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"defaultExport": "PHPLogo",
|
|
456
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
457
|
+
"externalPath": "components.admin.react.elements"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"defaultExport": "PHPFullLogo",
|
|
461
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
462
|
+
"externalPath": "components.admin.react.elements"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"defaultExport": "MicrosoftFullLogo",
|
|
466
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
467
|
+
"externalPath": "components.admin.react.elements"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
"defaultExport": "MicrosoftAltLogo",
|
|
471
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
472
|
+
"externalPath": "components.admin.react.elements"
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"defaultExport": "MandrillLogo",
|
|
476
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
477
|
+
"externalPath": "components.admin.react.elements"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"defaultExport": "MicrosoftLogo",
|
|
481
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
482
|
+
"externalPath": "components.admin.react.elements"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"defaultExport": "MailgunLogo",
|
|
486
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
487
|
+
"externalPath": "components.admin.react.elements"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"defaultExport": "MailSuccessBg",
|
|
491
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
492
|
+
"externalPath": "components.admin.react.elements"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"defaultExport": "MailgunFullLogo",
|
|
496
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
497
|
+
"externalPath": "components.admin.react.elements"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"defaultExport": "MailSuccess",
|
|
501
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
502
|
+
"externalPath": "components.admin.react.elements"
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
"defaultExport": "MailFailedBg",
|
|
506
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
507
|
+
"externalPath": "components.admin.react.elements"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"defaultExport": "MailFailed",
|
|
511
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
512
|
+
"externalPath": "components.admin.react.elements"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"defaultExport": "GravitySMTPTextLogo",
|
|
516
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
517
|
+
"externalPath": "components.admin.react.elements"
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"defaultExport": "GravitySMTPLogo",
|
|
521
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
522
|
+
"externalPath": "components.admin.react.elements"
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"defaultExport": "GravitySMTPFullLogo",
|
|
526
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
527
|
+
"externalPath": "components.admin.react.elements"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"defaultExport": "GoogleFullLogo",
|
|
531
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
532
|
+
"externalPath": "components.admin.react.elements"
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
"defaultExport": "GoogleLogo",
|
|
536
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
537
|
+
"externalPath": "components.admin.react.elements"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"defaultExport": "GoogleAltLogo",
|
|
541
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
542
|
+
"externalPath": "components.admin.react.elements"
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
"defaultExport": "CustomSMTPFull",
|
|
546
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
547
|
+
"externalPath": "components.admin.react.elements"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
"defaultExport": "CustomSMTP",
|
|
551
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
552
|
+
"externalPath": "components.admin.react.elements"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
"defaultExport": "BrevoFullLogo",
|
|
556
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
557
|
+
"externalPath": "components.admin.react.elements"
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
"defaultExport": "AmazonAWSLogo",
|
|
561
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
562
|
+
"externalPath": "components.admin.react.elements"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"defaultExport": "BrevoLogo",
|
|
566
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
567
|
+
"externalPath": "components.admin.react.elements"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
"defaultExport": "GravityFormsStackedLogo",
|
|
571
|
+
"importPath": "react/admin/elements/Svgs/",
|
|
572
|
+
"externalPath": "components.admin.react.elements"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
"defaultExport": "BrandedLink",
|
|
576
|
+
"importPath": "react/admin/elements/Link/",
|
|
577
|
+
"externalPath": "components.admin.react.elements"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"defaultExport": "BrandedButton",
|
|
581
|
+
"importPath": "react/admin/elements/Button/",
|
|
582
|
+
"externalPath": "components.admin.react.elements"
|
|
583
|
+
}
|
|
584
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gravityforms/dependency-extraction-webpack-plugin",
|
|
3
|
+
"version": "4.5.0-beta.1",
|
|
4
|
+
"description": "Dependency extraction webpack plugin for use in Gravity Forms development. Extends the WordPress plugin.",
|
|
5
|
+
"author": "Rocketgenius",
|
|
6
|
+
"license": "GPL-2.0-or-later",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"gravityforms",
|
|
9
|
+
"javascript",
|
|
10
|
+
"dependency-extraction"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/gravityforms/gravitypackages/tree/HEAD/packages/npm/dependency-extraction-webpack-plugin/README.md",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/gravityforms/gravitypackages.git",
|
|
16
|
+
"directory": "packages/npm/dependency-extraction-webpack-plugin"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/gravityforms/gravitypackages/issues"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20.10.0",
|
|
23
|
+
"npm": ">=10.2.3"
|
|
24
|
+
},
|
|
25
|
+
"main": "src/index.js",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"prepublishOnly": "node ../gulp-tasks/src/scripts/components-dist.js",
|
|
28
|
+
"pack": " npm run prepublishOnly && npm pack"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@wordpress/dependency-extraction-webpack-plugin": "^3.7.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const WPDependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
|
|
2
|
+
const getPackages = require( '../assets/get-packages' );
|
|
3
|
+
|
|
4
|
+
const ROOT_NAMESPACE = 'gform';
|
|
5
|
+
|
|
6
|
+
const gfRequestToExternal = ( request, excludedExternals, rootNameSpace ) => {
|
|
7
|
+
const packages = getPackages( rootNameSpace );
|
|
8
|
+
if ( packages.hasOwnProperty( request ) ) {
|
|
9
|
+
// Check if the request is in the excludedExternals array
|
|
10
|
+
if ( ( excludedExternals || [] ).includes( request ) ) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Return the external array
|
|
15
|
+
return packages[ request ].external;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const gfRequestToHandle = ( request, rootNameSpace ) => {
|
|
20
|
+
const packages = getPackages( rootNameSpace );
|
|
21
|
+
if ( packages.hasOwnProperty( request ) ) {
|
|
22
|
+
return packages[ request ].handle;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
class DependencyExtractionWebpackPlugin extends WPDependencyExtractionWebpackPlugin {
|
|
27
|
+
externalizeWpDeps( _context, request, callback ) {
|
|
28
|
+
const rootNameSpace = this.options.rootNamespace || ROOT_NAMESPACE;
|
|
29
|
+
let externalRequest;
|
|
30
|
+
|
|
31
|
+
// Handle via options.requestToExternal first
|
|
32
|
+
if ( typeof this.options.requestToExternal === 'function' ) {
|
|
33
|
+
externalRequest = this.options.requestToExternal( request );
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Cascade to default if unhandled and enabled
|
|
37
|
+
if (
|
|
38
|
+
typeof externalRequest === 'undefined' &&
|
|
39
|
+
this.options.useDefaults
|
|
40
|
+
) {
|
|
41
|
+
externalRequest = gfRequestToExternal(
|
|
42
|
+
request,
|
|
43
|
+
this.options.bundledPackages || [],
|
|
44
|
+
rootNameSpace
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if ( externalRequest ) {
|
|
49
|
+
this.externalizedDeps.add( request );
|
|
50
|
+
|
|
51
|
+
return callback( null, externalRequest );
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Fall back to the WP method
|
|
55
|
+
return super.externalizeWpDeps( _context, request, callback );
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
mapRequestToDependency( request ) {
|
|
59
|
+
const rootNameSpace = this.options.rootNamespace || ROOT_NAMESPACE;
|
|
60
|
+
// Handle via options.requestToHandle first
|
|
61
|
+
if ( typeof this.options.requestToHandle === 'function' ) {
|
|
62
|
+
const scriptDependency = this.options.requestToHandle( request );
|
|
63
|
+
if ( scriptDependency ) {
|
|
64
|
+
return scriptDependency;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Cascade to default if enabled
|
|
69
|
+
if ( this.options.useDefaults ) {
|
|
70
|
+
const scriptDependency = gfRequestToHandle( request, rootNameSpace );
|
|
71
|
+
if ( scriptDependency ) {
|
|
72
|
+
return scriptDependency;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Fall back to the WP method
|
|
77
|
+
return super.mapRequestToDependency( request );
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
module.exports = DependencyExtractionWebpackPlugin;
|