gdu 7.0.3 → 7.1.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/dist/config/webpack/plugins/GuruBuildManifest.d.ts +2 -2
- package/dist/config/webpack/plugins/GuruBuildManifest.js +3 -3
- package/dist/config/webpack/webpack.config.js +1 -1
- package/dist/lib/mfe.d.ts +3 -3
- package/dist/lib/mfe.js +26 -7
- package/dist/lib/mfe.js.map +1 -1
- package/gdu.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ interface Asset {
|
|
|
6
6
|
export interface Manifest {
|
|
7
7
|
hash: string;
|
|
8
8
|
mountDOMId?: string;
|
|
9
|
-
|
|
9
|
+
mountDOMClass?: string;
|
|
10
10
|
assets: Asset;
|
|
11
11
|
chunks: Asset;
|
|
12
12
|
}
|
|
@@ -19,7 +19,7 @@ declare const defaultOptions: {
|
|
|
19
19
|
includeChunks: boolean;
|
|
20
20
|
publicPath: string;
|
|
21
21
|
mountDOMId: string;
|
|
22
|
-
|
|
22
|
+
mountDOMClass: string;
|
|
23
23
|
};
|
|
24
24
|
export declare class GuruBuildManifest {
|
|
25
25
|
private options;
|
|
@@ -9,7 +9,7 @@ const path_1 = require("path");
|
|
|
9
9
|
const emptyResults = {
|
|
10
10
|
hash: '',
|
|
11
11
|
mountDOMId: '',
|
|
12
|
-
|
|
12
|
+
mountDOMClass: '',
|
|
13
13
|
assets: {
|
|
14
14
|
js: [],
|
|
15
15
|
css: [],
|
|
@@ -29,7 +29,7 @@ const defaultOptions = {
|
|
|
29
29
|
includeChunks: true,
|
|
30
30
|
publicPath: '',
|
|
31
31
|
mountDOMId: '',
|
|
32
|
-
|
|
32
|
+
mountDOMClass: '',
|
|
33
33
|
};
|
|
34
34
|
class GuruBuildManifest {
|
|
35
35
|
constructor(options) {
|
|
@@ -45,7 +45,7 @@ class GuruBuildManifest {
|
|
|
45
45
|
this.result = { ...emptyResults };
|
|
46
46
|
this.result.hash = compilation.hash;
|
|
47
47
|
this.result.mountDOMId = this.options.mountDOMId;
|
|
48
|
-
this.result.
|
|
48
|
+
this.result.mountDOMClass = this.options.mountDOMClass;
|
|
49
49
|
compilation.chunks.forEach((chunk) => {
|
|
50
50
|
chunk.files.forEach((filename) => {
|
|
51
51
|
if (this._excludeChunk(this.options.excludeFile, filename, chunk) === true) {
|
|
@@ -339,7 +339,7 @@ const baseOptions = (buildEnv, isMultiEnv, isDebug = false) => {
|
|
|
339
339
|
!isDev &&
|
|
340
340
|
new GuruBuildManifest_1.GuruBuildManifest({
|
|
341
341
|
mountDOMId: guruConfig.mountDOMId,
|
|
342
|
-
|
|
342
|
+
mountDOMClass: guruConfig.mountDOMClass,
|
|
343
343
|
outputDir: !isMultiEnv && buildEnv === 'prod'
|
|
344
344
|
? (0, path_1.resolve)(roots_1.PROJECT_ROOT, 'dist')
|
|
345
345
|
: (0, path_1.resolve)(roots_1.PROJECT_ROOT, 'dist', buildEnv),
|
package/dist/lib/mfe.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
interface Props {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
mountDOMId?: string | HTMLElement;
|
|
3
|
+
mountDOMClass?: string;
|
|
4
4
|
projectName: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const getMfeMountPoint: ({
|
|
6
|
+
export declare const getMfeMountPoint: ({ mountDOMId, mountDOMClass, projectName, }: Props) => HTMLElement | null;
|
|
7
7
|
export {};
|
package/dist/lib/mfe.js
CHANGED
|
@@ -2,14 +2,33 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMfeMountPoint = void 0;
|
|
4
4
|
const utilities_1 = require("@autoguru/utilities");
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const queryShadowRoot = (wrapElement, selector) => {
|
|
6
|
+
if (wrapElement && wrapElement.length > 0) {
|
|
7
|
+
for (const element of wrapElement) {
|
|
8
|
+
if (element.childNodes.length === 0) {
|
|
9
|
+
return Array.from(element.querySelectorAll(selector));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (wrapElement &&
|
|
14
|
+
wrapElement.firstChild &&
|
|
15
|
+
wrapElement.firstChild.shadowRoot) {
|
|
16
|
+
return wrapElement.firstChild.shadowRoot.querySelectorAll(selector);
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
};
|
|
20
|
+
const getMfeMountPoint = ({ mountDOMId, mountDOMClass, projectName, }) => {
|
|
21
|
+
(0, utilities_1.invariant)(mountDOMId || mountDOMClass, 'You must provide a mountDOMId or mountDOMClass');
|
|
7
22
|
let point = null;
|
|
8
|
-
|
|
9
|
-
|
|
23
|
+
const wrapElements = Array.from(document.querySelectorAll(`.${mountDOMId || mountDOMClass}-wrap`));
|
|
24
|
+
if (typeof mountDOMId === 'string') {
|
|
25
|
+
point =
|
|
26
|
+
queryShadowRoot(wrapElements, '#' + mountDOMId) ||
|
|
27
|
+
document.querySelector('#' + mountDOMId)[0];
|
|
10
28
|
}
|
|
11
|
-
else if (typeof
|
|
12
|
-
const elements =
|
|
29
|
+
else if (typeof mountDOMClass === 'string') {
|
|
30
|
+
const elements = queryShadowRoot(wrapElements, '.' + mountDOMClass) ||
|
|
31
|
+
Array.from(document.querySelectorAll('.' + mountDOMClass));
|
|
13
32
|
for (const element of elements) {
|
|
14
33
|
if (element.childNodes.length === 0) {
|
|
15
34
|
point = element;
|
|
@@ -18,7 +37,7 @@ const getMfeMountPoint = ({ mountDomId, mountDomClass, projectName, }) => {
|
|
|
18
37
|
}
|
|
19
38
|
}
|
|
20
39
|
else {
|
|
21
|
-
point =
|
|
40
|
+
point = mountDOMId;
|
|
22
41
|
}
|
|
23
42
|
if (point && typeof point === 'object') {
|
|
24
43
|
point.dataset.mfeAppName = projectName;
|
package/dist/lib/mfe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfe.js","sourceRoot":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AK,QAAQ,EAAE;QAC7C,MAAM,QAAQ,GACb,eAAe,CAAC,YAAY,EAAE,GAAG,GAAG,aAAa,CAAC;YAClD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,GAAG,aAAa,CAAC,CAAC,CAAC;QAC5D,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC/B,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;gBACpC,KAAK,GAAG,OAAsB,CAAC;gBAC/B,MAAM;aACN;SACD;KACD;SAAM;QACN,KAAK,GAAG,UAAU,CAAC;KACnB;IACD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACvC,KAAK,CAAC,OAAO,CAAC,UAAU,GAAG,WAAW,CAAC;QACvC,KAAK,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;KAC3C;IACD,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAnCW,QAAA,gBAAgB,oBAmC3B"}
|
package/gdu.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdu",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"description": "AutoGuru's development toolkit",
|
|
5
5
|
"homepage": "https://github.com/autoguru-au/octane/tree/master/packages/gdu#readme",
|
|
6
6
|
"repository": "https://github.com/autoguru-au/octane/tree/master/packages/gdu",
|