@elementor/generate-wordpress-asset-file-webpack-plugin 0.3.2 → 0.3.3
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.3.3](https://github.com/elementor/elementor-packages/compare/@elementor/generate-wordpress-asset-file-webpack-plugin@0.3.2...@elementor/generate-wordpress-asset-file-webpack-plugin@0.3.3) (2024-08-05)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- publish only necessary files to npm ([#226](https://github.com/elementor/elementor-packages/issues/226)) ([d808e2f](https://github.com/elementor/elementor-packages/commit/d808e2f60eb7ca2d7b8560d0b79c0e62c2f969a8))
|
|
11
|
+
|
|
6
12
|
## [0.3.2](https://github.com/elementor/elementor-packages/compare/@elementor/generate-wordpress-asset-file-webpack-plugin@0.3.1...@elementor/generate-wordpress-asset-file-webpack-plugin@0.3.2) (2024-07-16)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @elementor/generate-wordpress-asset-file-webpack-plugin
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/generate-wordpress-asset-file-webpack-plugin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "https://github.com/elementor/elementor-packages.git",
|
|
21
|
+
"url": "git+https://github.com/elementor/elementor-packages.git",
|
|
22
22
|
"directory": "packages/tools/generated-wordpress-asset-file-webpack-plugin"
|
|
23
23
|
},
|
|
24
24
|
"bugs": {
|
|
@@ -27,6 +27,13 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
+
"files": [
|
|
31
|
+
"README.md",
|
|
32
|
+
"CHANGELOG.md",
|
|
33
|
+
"/dist",
|
|
34
|
+
"/src",
|
|
35
|
+
"!**/__tests__"
|
|
36
|
+
],
|
|
30
37
|
"scripts": {
|
|
31
38
|
"build": "tsup --config=../../tsup.build.ts",
|
|
32
39
|
"dev": "tsup --config=../../tsup.dev.ts --format=esm,cjs"
|
|
@@ -34,5 +41,5 @@
|
|
|
34
41
|
"peerDependencies": {
|
|
35
42
|
"webpack": "5.x"
|
|
36
43
|
},
|
|
37
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "f4ca33da0842a29d83736d0a173633085edddaee"
|
|
38
45
|
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`@elementor/generate-wordpress-asset-file-webpack-plugin should generate assets files: app.asset.php 1`] = `
|
|
4
|
-
"<?php
|
|
5
|
-
if ( ! defined( 'ABSPATH' ) ) {
|
|
6
|
-
exit;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* This file is generated by Webpack, do not edit it directly.
|
|
10
|
-
*/
|
|
11
|
-
return [
|
|
12
|
-
'handle' => 'elementor-v2-app',
|
|
13
|
-
'deps' => [
|
|
14
|
-
'elementor-v2-editor',
|
|
15
|
-
'react',
|
|
16
|
-
'react-dom',
|
|
17
|
-
'wp-element',
|
|
18
|
-
],
|
|
19
|
-
];
|
|
20
|
-
"
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
exports[`@elementor/generate-wordpress-asset-file-webpack-plugin should generate assets files: extension.asset.php 1`] = `
|
|
24
|
-
"<?php
|
|
25
|
-
if ( ! defined( 'ABSPATH' ) ) {
|
|
26
|
-
exit;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* This file is generated by Webpack, do not edit it directly.
|
|
30
|
-
*/
|
|
31
|
-
return [
|
|
32
|
-
'handle' => 'elementor-v2-extension',
|
|
33
|
-
'deps' => [
|
|
34
|
-
'elementor-v2-editor',
|
|
35
|
-
'react',
|
|
36
|
-
'react-dom',
|
|
37
|
-
'wp-element',
|
|
38
|
-
],
|
|
39
|
-
];
|
|
40
|
-
"
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
exports[`@elementor/generate-wordpress-asset-file-webpack-plugin should generate assets files: util.asset.php 1`] = `
|
|
44
|
-
"<?php
|
|
45
|
-
if ( ! defined( 'ABSPATH' ) ) {
|
|
46
|
-
exit;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* This file is generated by Webpack, do not edit it directly.
|
|
50
|
-
*/
|
|
51
|
-
return [
|
|
52
|
-
'handle' => 'elementor-v2-util',
|
|
53
|
-
'deps' => [
|
|
54
|
-
'elementor-v2-editor',
|
|
55
|
-
'react',
|
|
56
|
-
'react-dom',
|
|
57
|
-
'wp-element',
|
|
58
|
-
],
|
|
59
|
-
];
|
|
60
|
-
"
|
|
61
|
-
`;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment node
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as fs from 'fs';
|
|
6
|
-
import * as path from 'path';
|
|
7
|
-
import { webpack } from 'webpack';
|
|
8
|
-
import { GenerateWordPressAssetFileWebpackPlugin } from '../index';
|
|
9
|
-
import { vol } from 'memfs';
|
|
10
|
-
|
|
11
|
-
jest.mock( 'fs', () => jest.requireActual( 'memfs' ) );
|
|
12
|
-
|
|
13
|
-
describe( '@elementor/generate-wordpress-asset-file-webpack-plugin', () => {
|
|
14
|
-
beforeEach( () => {
|
|
15
|
-
const fileContent = `
|
|
16
|
-
import elementor from '@elementor/editor';
|
|
17
|
-
import wp from '@wordpress/element';
|
|
18
|
-
import other from '@other/package';
|
|
19
|
-
import react from 'react';
|
|
20
|
-
import ReactDOM from 'react-dom';
|
|
21
|
-
|
|
22
|
-
elementor();
|
|
23
|
-
wp();
|
|
24
|
-
other();
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
fs.writeFileSync( path.resolve( '/app.js' ), fileContent );
|
|
28
|
-
fs.writeFileSync( path.resolve( '/extension.js' ), fileContent );
|
|
29
|
-
fs.writeFileSync( path.resolve( '/util.js' ), fileContent );
|
|
30
|
-
} );
|
|
31
|
-
|
|
32
|
-
afterEach( () => {
|
|
33
|
-
vol.reset();
|
|
34
|
-
} );
|
|
35
|
-
|
|
36
|
-
it( 'should generate assets files', ( done ) => {
|
|
37
|
-
// Arrange.
|
|
38
|
-
const compiler = webpack( {
|
|
39
|
-
mode: 'development',
|
|
40
|
-
entry: {
|
|
41
|
-
app: path.resolve( '/app.js' ),
|
|
42
|
-
extension: path.resolve( '/extension.js' ),
|
|
43
|
-
util: path.resolve( '/util.js' ),
|
|
44
|
-
},
|
|
45
|
-
output: {
|
|
46
|
-
filename: '[name].js',
|
|
47
|
-
path: path.resolve( '/dist' ),
|
|
48
|
-
},
|
|
49
|
-
externals: {
|
|
50
|
-
// Required so webpack won't try to resolve those packages, which don't exist.
|
|
51
|
-
'@elementor/editor': 'editor',
|
|
52
|
-
'@wordpress/element': 'wp',
|
|
53
|
-
'@other/package': 'other',
|
|
54
|
-
react: 'react',
|
|
55
|
-
'react-dom': 'reactDOM',
|
|
56
|
-
},
|
|
57
|
-
plugins: [
|
|
58
|
-
new GenerateWordPressAssetFileWebpackPlugin( {
|
|
59
|
-
handle: ( entryName ) => `elementor-v2-${ entryName }`,
|
|
60
|
-
map: [
|
|
61
|
-
{ request: 'react', handle: 'react' },
|
|
62
|
-
{ request: 'react-dom', handle: 'react-dom' },
|
|
63
|
-
{ request: /^@elementor\/(.+)$/, handle: 'elementor-v2-$1' },
|
|
64
|
-
{ request: /^@wordpress\/(.+)$/, handle: 'wp-$1' },
|
|
65
|
-
],
|
|
66
|
-
} ),
|
|
67
|
-
],
|
|
68
|
-
} );
|
|
69
|
-
|
|
70
|
-
// Expect.
|
|
71
|
-
expect.assertions( 6 );
|
|
72
|
-
|
|
73
|
-
// Act.
|
|
74
|
-
compiler.run( ( err, stats ) => {
|
|
75
|
-
// Assert.
|
|
76
|
-
expect( err ).toBe( null );
|
|
77
|
-
expect( stats?.hasErrors() ).toBe( false );
|
|
78
|
-
expect( stats?.hasWarnings() ).toBe( false );
|
|
79
|
-
|
|
80
|
-
const files = [ 'app.asset.php', 'extension.asset.php', 'util.asset.php' ];
|
|
81
|
-
|
|
82
|
-
files.forEach( ( fileName ) => {
|
|
83
|
-
const fileContent = fs.readFileSync( path.resolve( `/dist/${ fileName }` ), { encoding: 'utf8' } );
|
|
84
|
-
|
|
85
|
-
expect( fileContent ).toMatchSnapshot( fileName );
|
|
86
|
-
} );
|
|
87
|
-
|
|
88
|
-
done();
|
|
89
|
-
} );
|
|
90
|
-
} );
|
|
91
|
-
} );
|