gdu 7.0.3 → 7.1.0

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.
@@ -6,7 +6,7 @@ interface Asset {
6
6
  export interface Manifest {
7
7
  hash: string;
8
8
  mountDOMId?: string;
9
- mountDomClass?: string;
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
- mountDomClass: string;
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
- mountDomClass: '',
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
- mountDomClass: '',
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.mountDomClass = this.options.mountDomClass;
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
- mountDomClass: guruConfig.mountDOMClass,
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
- mountDomId?: string | HTMLElement;
3
- mountDomClass?: string;
2
+ mountDOMId?: string | HTMLElement;
3
+ mountDOMClass?: string;
4
4
  projectName: string;
5
5
  }
6
- export declare const getMfeMountPoint: ({ mountDomId, mountDomClass, projectName, }: Props) => HTMLElement | null;
6
+ export declare const getMfeMountPoint: ({ mountDOMId, mountDOMClass, projectName, }: Props) => HTMLElement | null;
7
7
  export {};
package/dist/lib/mfe.js CHANGED
@@ -2,23 +2,35 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMfeMountPoint = void 0;
4
4
  const utilities_1 = require("@autoguru/utilities");
5
- const getMfeMountPoint = ({ mountDomId, mountDomClass, projectName, }) => {
6
- (0, utilities_1.invariant)(mountDomId || mountDomClass, 'You must provide a mountDomId or mountDomClass');
5
+ const getMfeMountPoint = ({ mountDOMId, mountDOMClass, projectName, }) => {
6
+ (0, utilities_1.invariant)(mountDOMId || mountDOMClass, 'You must provide a mountDOMId or mountDOMClass');
7
7
  let point = null;
8
- if (typeof mountDomId === 'string') {
9
- point = document.querySelector('#' + mountDomId);
8
+ if (typeof mountDOMId === 'string') {
9
+ point = document.querySelector('#' + mountDOMId);
10
10
  }
11
- else if (typeof mountDomClass === 'string') {
12
- const elements = Array.from(document.querySelectorAll('.' + mountDomClass));
13
- for (const element of elements) {
14
- if (element.childNodes.length === 0) {
15
- point = element;
16
- break;
11
+ else if (typeof mountDOMClass === 'string') {
12
+ const wrapElement = document.querySelector(`.${mountDOMClass}-wrap`);
13
+ if (wrapElement && wrapElement.firstChild && wrapElement.firstChild.shadowRoot) {
14
+ const elements = Array.from(wrapElement.firstChild.shadowRoot.querySelectorAll('.' + mountDOMClass));
15
+ for (const element of elements) {
16
+ if (element.childNodes.length === 0) {
17
+ point = element;
18
+ break;
19
+ }
20
+ }
21
+ }
22
+ else {
23
+ const elements = Array.from(document.querySelectorAll('.' + mountDOMClass));
24
+ for (const element of elements) {
25
+ if (element.childNodes.length === 0) {
26
+ point = element;
27
+ break;
28
+ }
17
29
  }
18
30
  }
19
31
  }
20
32
  else {
21
- point = mountDomId;
33
+ point = mountDOMId;
22
34
  }
23
35
  if (point && typeof point === 'object') {
24
36
  point.dataset.mfeAppName = projectName;
@@ -1 +1 @@
1
- {"version":3,"file":"mfe.js","sourceRoot":"","sources":["../../lib/mfe.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAiBzC,MAAM,gBAAgB,GAAG,CAAC,EAChC,UAAU,EACV,aAAa,EACb,WAAW,GACJ,EAAsB,EAAE;IAC/B,IAAA,qBAAS,EACR,UAAU,IAAI,aAAa,EAC3B,gDAAgD,CAChD,CAAC;IACF,IAAI,KAAK,GAAuB,IAAI,CAAC;IACrC,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QACnC,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,GAAG,UAAU,CAAC,CAAC;KACjD;SAAM,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;QAC7C,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAC1B,QAAQ,CAAC,gBAAgB,CAAC,GAAG,GAAG,aAAa,CAAC,CAC9C,CAAC;QACF,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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AAU,CAAC,MAAM,KAAK,CAAC,EAAE;oBACpC,KAAK,GAAG,OAAsB,CAAC;oBAC/B,MAAM;iBACN;aACD;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;AA5CW,QAAA,gBAAgB,oBA4C3B"}
package/gdu.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  */
4
4
  declare const __DEV__: boolean;
5
5
  declare const __MOUNT_DOM_ID__: string;
6
+ declare const __MOUNT_DOM_CLASS__: string;
6
7
  declare const __DEBUG__: boolean;
7
8
 
8
9
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdu",
3
- "version": "7.0.3",
3
+ "version": "7.1.0",
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",