@pinegrow/iles-module 3.0.7 → 3.0.13-beta.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.
package/dist/index.cjs CHANGED
@@ -1,19 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/index.ts
2
- var _nodehtmlparser = require('node-html-parser'); var _nodehtmlparser2 = _interopRequireDefault(_nodehtmlparser);
3
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
4
- var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }// src/index.ts
5
2
  async function getViteConfiguration(moduleOptions) {
6
3
  let vitePlugin;
7
4
  try {
8
5
  const { liveDesigner } = await Promise.resolve().then(() => _interopRequireWildcard(require("./live-designer-6F4BNNQY.cjs")));
9
6
  vitePlugin = liveDesigner({
10
- /* mappingType: 'type3', */
11
- tailwindcss: {
12
- configPath: "tailwind.config.js",
13
- cssPath: "@/assets/css/tailwind.css"
14
- // restartOnConfigUpdate: false,
15
- // restartOnThemeUpdate: false,
16
- },
17
7
  ...(moduleOptions == null ? void 0 : moduleOptions.liveDesigner) || {}
18
8
  });
19
9
  } catch (err) {
@@ -23,134 +13,16 @@ async function getViteConfiguration(moduleOptions) {
23
13
  const config = {
24
14
  plugins: vitePlugin ? [vitePlugin] : []
25
15
  };
26
- const isObject$1 = (value) => {
27
- return Object.prototype.toString.call(value) === "[object Object]";
28
- };
29
- const arraify = (target) => {
30
- return Array.isArray(target) ? target : [target];
31
- };
32
- const mergeConfigRecursively = (defaults, overrides) => {
33
- const merged = { ...defaults };
34
- for (const key in overrides) {
35
- const value = overrides[key];
36
- if (value == null) {
37
- continue;
38
- }
39
- const existing = merged[key];
40
- if (existing == null) {
41
- merged[key] = value;
42
- continue;
43
- }
44
- if (Array.isArray(existing) || Array.isArray(value)) {
45
- merged[key] = [
46
- ...arraify(existing !== null && existing !== void 0 ? existing : []),
47
- ...arraify(value !== null && value !== void 0 ? value : [])
48
- ];
49
- continue;
50
- }
51
- if (isObject$1(existing) && isObject$1(value)) {
52
- merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
53
- continue;
54
- }
55
- merged[key] = value;
56
- }
57
- return merged;
58
- };
59
16
  return config;
60
17
  }
61
18
  async function src_default(moduleOptions) {
62
19
  return {
63
20
  name: "@pinegrow/iles-module",
64
- vite: await getViteConfiguration(moduleOptions),
21
+ vite: await getViteConfiguration(moduleOptions)
65
22
  // Just like in Vite plugins you can use this hook to extend the user config
66
- config(config) {
67
- config.ssg.beforePageRender = (page) => {
68
- const doc = _nodehtmlparser2.default.parse(page.rendered, "text/html");
69
- const addons = [
70
- {
71
- name: "pgia",
72
- resources: [
73
- {
74
- // condition: 'interactions',
75
- parentResource: `public/pgia`,
76
- // relative to project root, must exists
77
- // source: `<script src="pgia/index.js"></script>`,
78
- injectTo: "head-append",
79
- tag: "script",
80
- children: `
81
- /* 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);}})()`
82
- },
83
- {
84
- // condition: 'interactions',
85
- parentResource: `public/pgia`,
86
- // relative to project root, must exists
87
- injectTo: "body-append",
88
- tag: "script",
89
- attrs: { src: "/pgia/lib/index.js" }
90
- }
91
- ]
92
- }
93
- ];
94
- addons.forEach((addon) => {
95
- addon.resources.forEach((resource) => {
96
- if (!resource.condition) {
97
- try {
98
- let parentResourceExists = true;
99
- if (resource.parentResource) {
100
- const projectRoot = (
101
- /*this.projectRoot ||*/
102
- process.cwd()
103
- );
104
- const resourcePath = _path2.default.resolve(projectRoot, resource.parentResource);
105
- parentResourceExists = parentResourceExists && _fs2.default.existsSync(resourcePath);
106
- }
107
- if (parentResourceExists) {
108
- const attrContent = Object.entries(resource.attrs || {}).reduce(
109
- (acc, [key, value]) => {
110
- return `${acc}${key}${value && value !== true ? `="${value}"` : ""}`;
111
- },
112
- ""
113
- );
114
- let parentNode, sourceNode;
115
- switch (resource.injectTo) {
116
- case "head-prepend":
117
- parentNode = doc.querySelector("head");
118
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
119
- ${resource.children || ""}
120
- </${resource.tag}>`);
121
- parentNode.childNodes.unshift(sourceNode);
122
- break;
123
- case "head-append":
124
- parentNode = doc.querySelector("head");
125
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
126
- ${resource.children || ""}
127
- </${resource.tag}>`);
128
- parentNode.appendChild(sourceNode);
129
- break;
130
- case "body-prepend":
131
- parentNode = doc.querySelector("body");
132
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
133
- ${resource.children || ""}
134
- </${resource.tag}>`);
135
- parentNode.childNodes.unshift(sourceNode);
136
- break;
137
- case "body-append":
138
- parentNode = doc.querySelector("body");
139
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
140
- ${resource.children || ""}
141
- </${resource.tag}>`);
142
- parentNode.appendChild(sourceNode);
143
- break;
144
- }
145
- }
146
- } catch (err) {
147
- }
148
- }
149
- });
150
- });
151
- page.rendered = doc.outerHTML;
152
- };
153
- }
23
+ // config(config) {
24
+ // // config.vue.reactivityTransform = false
25
+ // },
154
26
  };
155
27
  }
156
28
 
package/dist/index.js CHANGED
@@ -1,19 +1,9 @@
1
1
  // src/index.ts
2
- import htmlParser from "node-html-parser";
3
- import path from "path";
4
- import fs from "fs";
5
2
  async function getViteConfiguration(moduleOptions) {
6
3
  let vitePlugin;
7
4
  try {
8
5
  const { liveDesigner } = await import("./live-designer-6WHNERBU.js");
9
6
  vitePlugin = liveDesigner({
10
- /* mappingType: 'type3', */
11
- tailwindcss: {
12
- configPath: "tailwind.config.js",
13
- cssPath: "@/assets/css/tailwind.css"
14
- // restartOnConfigUpdate: false,
15
- // restartOnThemeUpdate: false,
16
- },
17
7
  ...(moduleOptions == null ? void 0 : moduleOptions.liveDesigner) || {}
18
8
  });
19
9
  } catch (err) {
@@ -23,134 +13,16 @@ async function getViteConfiguration(moduleOptions) {
23
13
  const config = {
24
14
  plugins: vitePlugin ? [vitePlugin] : []
25
15
  };
26
- const isObject$1 = (value) => {
27
- return Object.prototype.toString.call(value) === "[object Object]";
28
- };
29
- const arraify = (target) => {
30
- return Array.isArray(target) ? target : [target];
31
- };
32
- const mergeConfigRecursively = (defaults, overrides) => {
33
- const merged = { ...defaults };
34
- for (const key in overrides) {
35
- const value = overrides[key];
36
- if (value == null) {
37
- continue;
38
- }
39
- const existing = merged[key];
40
- if (existing == null) {
41
- merged[key] = value;
42
- continue;
43
- }
44
- if (Array.isArray(existing) || Array.isArray(value)) {
45
- merged[key] = [
46
- ...arraify(existing !== null && existing !== void 0 ? existing : []),
47
- ...arraify(value !== null && value !== void 0 ? value : [])
48
- ];
49
- continue;
50
- }
51
- if (isObject$1(existing) && isObject$1(value)) {
52
- merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
53
- continue;
54
- }
55
- merged[key] = value;
56
- }
57
- return merged;
58
- };
59
16
  return config;
60
17
  }
61
18
  async function src_default(moduleOptions) {
62
19
  return {
63
20
  name: "@pinegrow/iles-module",
64
- vite: await getViteConfiguration(moduleOptions),
21
+ vite: await getViteConfiguration(moduleOptions)
65
22
  // Just like in Vite plugins you can use this hook to extend the user config
66
- config(config) {
67
- config.ssg.beforePageRender = (page) => {
68
- const doc = htmlParser.parse(page.rendered, "text/html");
69
- const addons = [
70
- {
71
- name: "pgia",
72
- resources: [
73
- {
74
- // condition: 'interactions',
75
- parentResource: `public/pgia`,
76
- // relative to project root, must exists
77
- // source: `<script src="pgia/index.js"></script>`,
78
- injectTo: "head-append",
79
- tag: "script",
80
- children: `
81
- /* 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);}})()`
82
- },
83
- {
84
- // condition: 'interactions',
85
- parentResource: `public/pgia`,
86
- // relative to project root, must exists
87
- injectTo: "body-append",
88
- tag: "script",
89
- attrs: { src: "/pgia/lib/index.js" }
90
- }
91
- ]
92
- }
93
- ];
94
- addons.forEach((addon) => {
95
- addon.resources.forEach((resource) => {
96
- if (!resource.condition) {
97
- try {
98
- let parentResourceExists = true;
99
- if (resource.parentResource) {
100
- const projectRoot = (
101
- /*this.projectRoot ||*/
102
- process.cwd()
103
- );
104
- const resourcePath = path.resolve(projectRoot, resource.parentResource);
105
- parentResourceExists = parentResourceExists && fs.existsSync(resourcePath);
106
- }
107
- if (parentResourceExists) {
108
- const attrContent = Object.entries(resource.attrs || {}).reduce(
109
- (acc, [key, value]) => {
110
- return `${acc}${key}${value && value !== true ? `="${value}"` : ""}`;
111
- },
112
- ""
113
- );
114
- let parentNode, sourceNode;
115
- switch (resource.injectTo) {
116
- case "head-prepend":
117
- parentNode = doc.querySelector("head");
118
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
119
- ${resource.children || ""}
120
- </${resource.tag}>`);
121
- parentNode.childNodes.unshift(sourceNode);
122
- break;
123
- case "head-append":
124
- parentNode = doc.querySelector("head");
125
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
126
- ${resource.children || ""}
127
- </${resource.tag}>`);
128
- parentNode.appendChild(sourceNode);
129
- break;
130
- case "body-prepend":
131
- parentNode = doc.querySelector("body");
132
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
133
- ${resource.children || ""}
134
- </${resource.tag}>`);
135
- parentNode.childNodes.unshift(sourceNode);
136
- break;
137
- case "body-append":
138
- parentNode = doc.querySelector("body");
139
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
140
- ${resource.children || ""}
141
- </${resource.tag}>`);
142
- parentNode.appendChild(sourceNode);
143
- break;
144
- }
145
- }
146
- } catch (err) {
147
- }
148
- }
149
- });
150
- });
151
- page.rendered = doc.outerHTML;
152
- };
153
- }
23
+ // config(config) {
24
+ // // config.vue.reactivityTransform = false
25
+ // },
154
26
  };
155
27
  }
156
28
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinegrow/iles-module",
3
- "version": "3.0.7",
3
+ "version": "3.0.13-beta.0",
4
4
  "description": "Pinegrow Iles Module",
5
5
  "author": "Pinegrow (http://pinegrow.com/)",
6
6
  "license": "MIT",
@@ -33,11 +33,12 @@
33
33
  "prepublishOnly": "npm run build",
34
34
  "release": "npx bumpp --commit --tag --push && npm publish --access public",
35
35
  "publish-beta": "npm run increment-beta-version && npm publish",
36
- "increment-beta-version": "npm version prerelease --preid=beta"
36
+ "increment-beta-version": "npm version prerelease --preid=beta",
37
+ "publish-patch": "npm publish",
38
+ "increment-version": "npm version patch"
37
39
  },
38
40
  "dependencies": {
39
- "@pinegrow/vite-plugin": "3.0.7",
40
- "node-html-parser": "^6.1.5"
41
+ "@pinegrow/vite-plugin": "3.0.12"
41
42
  },
42
43
  "devDependencies": {
43
44
  "iles": "^0.8",
@@ -45,4 +46,3 @@
45
46
  "typescript": "^4.7"
46
47
  }
47
48
  }
48
-