@pinegrow/iles-module 3.0.0-beta.110 → 3.0.0-beta.111

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/index.cjs CHANGED
@@ -95,96 +95,89 @@ async function src_default(moduleOptions) {
95
95
  vite: await getViteConfiguration(moduleOptions),
96
96
  // Just like in Vite plugins you can use this hook to extend the user config
97
97
  config(config) {
98
- return {
99
- vue: {
100
- reactivityTransform: false
101
- },
102
- ssg: {
103
- beforePageRender: (page) => {
104
- const doc = _nodehtmlparser2.default.parse(page.rendered, "text/html");
105
- const addons = [
98
+ config.vue.reactivityTransform = false;
99
+ config.ssg.beforePageRender = (page) => {
100
+ const doc = _nodehtmlparser2.default.parse(page.rendered, "text/html");
101
+ const addons = [
102
+ {
103
+ name: "pgia",
104
+ resources: [
106
105
  {
107
- name: "pgia",
108
- resources: [
109
- {
110
- // condition: 'interactions',
111
- parentResource: `public/pgia`,
112
- // relative to project root, must exists
113
- // source: `<script src="pgia/index.js"></script>`,
114
- injectTo: "head-append",
115
- tag: "script",
116
- children: `
117
- /* Pinegrow Interactions, do not remove */ (function(){try{if(!document.documentElement.hasAttribute('data-pg-ia-disabled')) { window.pgia_small_mq=typeof pgia_small_mq=='string'?pgia_small_mq:'(max-width:767px)';window.pgia_large_mq=typeof pgia_large_mq=='string'?pgia_large_mq:'(min-width:768px)';var style = document.createElement('style');var pgcss='html:not(.pg-ia-no-preview) [data-pg-ia-hide=""] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show=""] {opacity:1;visibility:visible;display:block;}';if(document.documentElement.hasAttribute('data-pg-id') && document.documentElement.hasAttribute('data-pg-mobile')) {pgia_small_mq='(min-width:0)';pgia_large_mq='(min-width:99999px)'} pgcss+='@media ' + pgia_small_mq + '{ html:not(.pg-ia-no-preview) [data-pg-ia-hide="mobile"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="mobile"] {opacity:1;visibility:visible;display:block;}}';pgcss+='@media ' + pgia_large_mq + '{html:not(.pg-ia-no-preview) [data-pg-ia-hide="desktop"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="desktop"] {opacity:1;visibility:visible;display:block;}}';style.innerHTML=pgcss;document.querySelector('head').appendChild(style);}}catch(e){console&&console.log(e);}})()`
118
- },
119
- {
120
- // condition: 'interactions',
121
- parentResource: `public/pgia`,
122
- // relative to project root, must exists
123
- injectTo: "body-append",
124
- tag: "script",
125
- attrs: { src: "/pgia/lib/index.js" }
126
- }
127
- ]
106
+ // condition: 'interactions',
107
+ parentResource: `public/pgia`,
108
+ // relative to project root, must exists
109
+ // source: `<script src="pgia/index.js"></script>`,
110
+ injectTo: "head-append",
111
+ tag: "script",
112
+ children: `
113
+ /* Pinegrow Interactions, do not remove */ (function(){try{if(!document.documentElement.hasAttribute('data-pg-ia-disabled')) { window.pgia_small_mq=typeof pgia_small_mq=='string'?pgia_small_mq:'(max-width:767px)';window.pgia_large_mq=typeof pgia_large_mq=='string'?pgia_large_mq:'(min-width:768px)';var style = document.createElement('style');var pgcss='html:not(.pg-ia-no-preview) [data-pg-ia-hide=""] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show=""] {opacity:1;visibility:visible;display:block;}';if(document.documentElement.hasAttribute('data-pg-id') && document.documentElement.hasAttribute('data-pg-mobile')) {pgia_small_mq='(min-width:0)';pgia_large_mq='(min-width:99999px)'} pgcss+='@media ' + pgia_small_mq + '{ html:not(.pg-ia-no-preview) [data-pg-ia-hide="mobile"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="mobile"] {opacity:1;visibility:visible;display:block;}}';pgcss+='@media ' + pgia_large_mq + '{html:not(.pg-ia-no-preview) [data-pg-ia-hide="desktop"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="desktop"] {opacity:1;visibility:visible;display:block;}}';style.innerHTML=pgcss;document.querySelector('head').appendChild(style);}}catch(e){console&&console.log(e);}})()`
114
+ },
115
+ {
116
+ // condition: 'interactions',
117
+ parentResource: `public/pgia`,
118
+ // relative to project root, must exists
119
+ injectTo: "body-append",
120
+ tag: "script",
121
+ attrs: { src: "/pgia/lib/index.js" }
128
122
  }
129
- ];
130
- addons.forEach((addon) => {
131
- addon.resources.forEach((resource) => {
132
- if (!resource.condition) {
133
- try {
134
- let parentResourceExists = true;
135
- if (resource.parentResource) {
136
- const projectRoot = process.cwd();
137
- const resourcePath = _path2.default.resolve(projectRoot, resource.parentResource);
138
- parentResourceExists = parentResourceExists && _fs2.default.existsSync(resourcePath);
139
- }
140
- if (parentResourceExists) {
141
- const attrContent = Object.entries(resource.attrs || {}).reduce(
142
- (acc, [key, value]) => {
143
- return `${acc}${key}${value && value !== true ? `="${value}"` : ""}`;
144
- },
145
- ""
146
- );
147
- let parentNode, sourceNode;
148
- switch (resource.injectTo) {
149
- case "head-prepend":
150
- parentNode = doc.querySelector("head");
151
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
152
- ${resource.children || ""}
153
- </${resource.tag}>`);
154
- parentNode.childNodes.unshift(sourceNode);
155
- break;
156
- case "head-append":
157
- parentNode = doc.querySelector("head");
158
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
159
- ${resource.children || ""}
160
- </${resource.tag}>`);
161
- parentNode.appendChild(sourceNode);
162
- break;
163
- case "body-prepend":
164
- parentNode = doc.querySelector("body");
165
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
166
- ${resource.children || ""}
167
- </${resource.tag}>`);
168
- parentNode.childNodes.unshift(sourceNode);
169
- break;
170
- case "body-append":
171
- parentNode = doc.querySelector("body");
172
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
173
- ${resource.children || ""}
174
- </${resource.tag}>`);
175
- parentNode.appendChild(sourceNode);
176
- break;
177
- }
178
- }
179
- } catch (err) {
123
+ ]
124
+ }
125
+ ];
126
+ addons.forEach((addon) => {
127
+ addon.resources.forEach((resource) => {
128
+ if (!resource.condition) {
129
+ try {
130
+ let parentResourceExists = true;
131
+ if (resource.parentResource) {
132
+ const projectRoot = process.cwd();
133
+ const resourcePath = _path2.default.resolve(projectRoot, resource.parentResource);
134
+ parentResourceExists = parentResourceExists && _fs2.default.existsSync(resourcePath);
135
+ }
136
+ if (parentResourceExists) {
137
+ const attrContent = Object.entries(resource.attrs || {}).reduce(
138
+ (acc, [key, value]) => {
139
+ return `${acc}${key}${value && value !== true ? `="${value}"` : ""}`;
140
+ },
141
+ ""
142
+ );
143
+ let parentNode, sourceNode;
144
+ switch (resource.injectTo) {
145
+ case "head-prepend":
146
+ parentNode = doc.querySelector("head");
147
+ sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
148
+ ${resource.children || ""}
149
+ </${resource.tag}>`);
150
+ parentNode.childNodes.unshift(sourceNode);
151
+ break;
152
+ case "head-append":
153
+ parentNode = doc.querySelector("head");
154
+ sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
155
+ ${resource.children || ""}
156
+ </${resource.tag}>`);
157
+ parentNode.appendChild(sourceNode);
158
+ break;
159
+ case "body-prepend":
160
+ parentNode = doc.querySelector("body");
161
+ sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
162
+ ${resource.children || ""}
163
+ </${resource.tag}>`);
164
+ parentNode.childNodes.unshift(sourceNode);
165
+ break;
166
+ case "body-append":
167
+ parentNode = doc.querySelector("body");
168
+ sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
169
+ ${resource.children || ""}
170
+ </${resource.tag}>`);
171
+ parentNode.appendChild(sourceNode);
172
+ break;
180
173
  }
181
174
  }
182
- });
183
- });
184
- page.rendered = doc.outerHTML;
185
- }
186
- },
187
- ...config
175
+ } catch (err) {
176
+ }
177
+ }
178
+ });
179
+ });
180
+ page.rendered = doc.outerHTML;
188
181
  };
189
182
  }
190
183
  };
package/dist/index.js CHANGED
@@ -95,96 +95,89 @@ async function src_default(moduleOptions) {
95
95
  vite: await getViteConfiguration(moduleOptions),
96
96
  // Just like in Vite plugins you can use this hook to extend the user config
97
97
  config(config) {
98
- return {
99
- vue: {
100
- reactivityTransform: false
101
- },
102
- ssg: {
103
- beforePageRender: (page) => {
104
- const doc = htmlParser.parse(page.rendered, "text/html");
105
- const addons = [
98
+ config.vue.reactivityTransform = false;
99
+ config.ssg.beforePageRender = (page) => {
100
+ const doc = htmlParser.parse(page.rendered, "text/html");
101
+ const addons = [
102
+ {
103
+ name: "pgia",
104
+ resources: [
106
105
  {
107
- name: "pgia",
108
- resources: [
109
- {
110
- // condition: 'interactions',
111
- parentResource: `public/pgia`,
112
- // relative to project root, must exists
113
- // source: `<script src="pgia/index.js"></script>`,
114
- injectTo: "head-append",
115
- tag: "script",
116
- children: `
117
- /* Pinegrow Interactions, do not remove */ (function(){try{if(!document.documentElement.hasAttribute('data-pg-ia-disabled')) { window.pgia_small_mq=typeof pgia_small_mq=='string'?pgia_small_mq:'(max-width:767px)';window.pgia_large_mq=typeof pgia_large_mq=='string'?pgia_large_mq:'(min-width:768px)';var style = document.createElement('style');var pgcss='html:not(.pg-ia-no-preview) [data-pg-ia-hide=""] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show=""] {opacity:1;visibility:visible;display:block;}';if(document.documentElement.hasAttribute('data-pg-id') && document.documentElement.hasAttribute('data-pg-mobile')) {pgia_small_mq='(min-width:0)';pgia_large_mq='(min-width:99999px)'} pgcss+='@media ' + pgia_small_mq + '{ html:not(.pg-ia-no-preview) [data-pg-ia-hide="mobile"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="mobile"] {opacity:1;visibility:visible;display:block;}}';pgcss+='@media ' + pgia_large_mq + '{html:not(.pg-ia-no-preview) [data-pg-ia-hide="desktop"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="desktop"] {opacity:1;visibility:visible;display:block;}}';style.innerHTML=pgcss;document.querySelector('head').appendChild(style);}}catch(e){console&&console.log(e);}})()`
118
- },
119
- {
120
- // condition: 'interactions',
121
- parentResource: `public/pgia`,
122
- // relative to project root, must exists
123
- injectTo: "body-append",
124
- tag: "script",
125
- attrs: { src: "/pgia/lib/index.js" }
126
- }
127
- ]
106
+ // condition: 'interactions',
107
+ parentResource: `public/pgia`,
108
+ // relative to project root, must exists
109
+ // source: `<script src="pgia/index.js"></script>`,
110
+ injectTo: "head-append",
111
+ tag: "script",
112
+ children: `
113
+ /* Pinegrow Interactions, do not remove */ (function(){try{if(!document.documentElement.hasAttribute('data-pg-ia-disabled')) { window.pgia_small_mq=typeof pgia_small_mq=='string'?pgia_small_mq:'(max-width:767px)';window.pgia_large_mq=typeof pgia_large_mq=='string'?pgia_large_mq:'(min-width:768px)';var style = document.createElement('style');var pgcss='html:not(.pg-ia-no-preview) [data-pg-ia-hide=""] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show=""] {opacity:1;visibility:visible;display:block;}';if(document.documentElement.hasAttribute('data-pg-id') && document.documentElement.hasAttribute('data-pg-mobile')) {pgia_small_mq='(min-width:0)';pgia_large_mq='(min-width:99999px)'} pgcss+='@media ' + pgia_small_mq + '{ html:not(.pg-ia-no-preview) [data-pg-ia-hide="mobile"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="mobile"] {opacity:1;visibility:visible;display:block;}}';pgcss+='@media ' + pgia_large_mq + '{html:not(.pg-ia-no-preview) [data-pg-ia-hide="desktop"] {opacity:0;visibility:hidden;}html:not(.pg-ia-no-preview) [data-pg-ia-show="desktop"] {opacity:1;visibility:visible;display:block;}}';style.innerHTML=pgcss;document.querySelector('head').appendChild(style);}}catch(e){console&&console.log(e);}})()`
114
+ },
115
+ {
116
+ // condition: 'interactions',
117
+ parentResource: `public/pgia`,
118
+ // relative to project root, must exists
119
+ injectTo: "body-append",
120
+ tag: "script",
121
+ attrs: { src: "/pgia/lib/index.js" }
128
122
  }
129
- ];
130
- addons.forEach((addon) => {
131
- addon.resources.forEach((resource) => {
132
- if (!resource.condition) {
133
- try {
134
- let parentResourceExists = true;
135
- if (resource.parentResource) {
136
- const projectRoot = process.cwd();
137
- const resourcePath = path.resolve(projectRoot, resource.parentResource);
138
- parentResourceExists = parentResourceExists && fs.existsSync(resourcePath);
139
- }
140
- if (parentResourceExists) {
141
- const attrContent = Object.entries(resource.attrs || {}).reduce(
142
- (acc, [key, value]) => {
143
- return `${acc}${key}${value && value !== true ? `="${value}"` : ""}`;
144
- },
145
- ""
146
- );
147
- let parentNode, sourceNode;
148
- switch (resource.injectTo) {
149
- case "head-prepend":
150
- parentNode = doc.querySelector("head");
151
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
152
- ${resource.children || ""}
153
- </${resource.tag}>`);
154
- parentNode.childNodes.unshift(sourceNode);
155
- break;
156
- case "head-append":
157
- parentNode = doc.querySelector("head");
158
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
159
- ${resource.children || ""}
160
- </${resource.tag}>`);
161
- parentNode.appendChild(sourceNode);
162
- break;
163
- case "body-prepend":
164
- parentNode = doc.querySelector("body");
165
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
166
- ${resource.children || ""}
167
- </${resource.tag}>`);
168
- parentNode.childNodes.unshift(sourceNode);
169
- break;
170
- case "body-append":
171
- parentNode = doc.querySelector("body");
172
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
173
- ${resource.children || ""}
174
- </${resource.tag}>`);
175
- parentNode.appendChild(sourceNode);
176
- break;
177
- }
178
- }
179
- } catch (err) {
123
+ ]
124
+ }
125
+ ];
126
+ addons.forEach((addon) => {
127
+ addon.resources.forEach((resource) => {
128
+ if (!resource.condition) {
129
+ try {
130
+ let parentResourceExists = true;
131
+ if (resource.parentResource) {
132
+ const projectRoot = process.cwd();
133
+ const resourcePath = path.resolve(projectRoot, resource.parentResource);
134
+ parentResourceExists = parentResourceExists && fs.existsSync(resourcePath);
135
+ }
136
+ if (parentResourceExists) {
137
+ const attrContent = Object.entries(resource.attrs || {}).reduce(
138
+ (acc, [key, value]) => {
139
+ return `${acc}${key}${value && value !== true ? `="${value}"` : ""}`;
140
+ },
141
+ ""
142
+ );
143
+ let parentNode, sourceNode;
144
+ switch (resource.injectTo) {
145
+ case "head-prepend":
146
+ parentNode = doc.querySelector("head");
147
+ sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
148
+ ${resource.children || ""}
149
+ </${resource.tag}>`);
150
+ parentNode.childNodes.unshift(sourceNode);
151
+ break;
152
+ case "head-append":
153
+ parentNode = doc.querySelector("head");
154
+ sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
155
+ ${resource.children || ""}
156
+ </${resource.tag}>`);
157
+ parentNode.appendChild(sourceNode);
158
+ break;
159
+ case "body-prepend":
160
+ parentNode = doc.querySelector("body");
161
+ sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
162
+ ${resource.children || ""}
163
+ </${resource.tag}>`);
164
+ parentNode.childNodes.unshift(sourceNode);
165
+ break;
166
+ case "body-append":
167
+ parentNode = doc.querySelector("body");
168
+ sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
169
+ ${resource.children || ""}
170
+ </${resource.tag}>`);
171
+ parentNode.appendChild(sourceNode);
172
+ break;
180
173
  }
181
174
  }
182
- });
183
- });
184
- page.rendered = doc.outerHTML;
185
- }
186
- },
187
- ...config
175
+ } catch (err) {
176
+ }
177
+ }
178
+ });
179
+ });
180
+ page.rendered = doc.outerHTML;
188
181
  };
189
182
  }
190
183
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinegrow/iles-module",
3
- "version": "3.0.0-beta.110",
3
+ "version": "3.0.0-beta.111",
4
4
  "description": "Pinegrow Iles Module",
5
5
  "author": "Pinegrow (http://pinegrow.com/)",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "increment-beta-version": "npm version prerelease --preid=beta"
32
32
  },
33
33
  "dependencies": {
34
- "@pinegrow/vite-plugin": "3.0.0-beta.110",
34
+ "@pinegrow/vite-plugin": "3.0.0-beta.111",
35
35
  "node-html-parser": "^6.1.5",
36
36
  "unplugin-auto-import": "^0.15.2"
37
37
  },