@pinegrow/iles-module 3.0.0-beta.109 → 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 +90 -83
- package/dist/index.js +90 -83
- package/dist/live-designer-6F4BNNQY.cjs +7 -0
- package/dist/live-designer-6WHNERBU.js +7 -0
- package/package.json +5 -8
package/dist/index.cjs
CHANGED
|
@@ -7,8 +7,9 @@ async function getViteConfiguration(moduleOptions) {
|
|
|
7
7
|
var _a;
|
|
8
8
|
let vitePlugin;
|
|
9
9
|
try {
|
|
10
|
-
const { liveDesigner } = await Promise.resolve().then(() => require("./live-designer-
|
|
10
|
+
const { liveDesigner } = await Promise.resolve().then(() => require("./live-designer-6F4BNNQY.cjs"));
|
|
11
11
|
vitePlugin = liveDesigner({
|
|
12
|
+
/* mappingType: 'type3', */
|
|
12
13
|
tailwindcss: {
|
|
13
14
|
configPath: "tailwind.config.js",
|
|
14
15
|
cssPath: "@/assets/css/tailwind.css",
|
|
@@ -61,17 +62,24 @@ async function getViteConfiguration(moduleOptions) {
|
|
|
61
62
|
return mergeConfigRecursively(defaults || {}, overrides || {});
|
|
62
63
|
};
|
|
63
64
|
(_a = config.plugins) == null ? void 0 : _a.push(
|
|
65
|
+
// autoImportComponents(mergeConfig({}, moduleOptions.autoImportComponents)),
|
|
64
66
|
_vite2.default.call(void 0,
|
|
65
67
|
mergeConfig(
|
|
66
68
|
{
|
|
67
69
|
include: [
|
|
68
70
|
/\.[tj]sx?$/,
|
|
71
|
+
// .ts, .tsx, .js, .jsx
|
|
69
72
|
/\.vue$/,
|
|
70
73
|
/\.vue\?vue/,
|
|
74
|
+
// .vue
|
|
71
75
|
/\.md$/
|
|
76
|
+
// .md
|
|
72
77
|
],
|
|
73
78
|
imports: ["vue", "vue-router"],
|
|
74
|
-
dirs: [
|
|
79
|
+
dirs: [
|
|
80
|
+
// 'src/composables',
|
|
81
|
+
// 'src/stores',
|
|
82
|
+
],
|
|
75
83
|
vueTemplate: true,
|
|
76
84
|
cache: true
|
|
77
85
|
},
|
|
@@ -85,92 +93,91 @@ async function src_default(moduleOptions) {
|
|
|
85
93
|
return {
|
|
86
94
|
name: "@pinegrow/iles-module",
|
|
87
95
|
vite: await getViteConfiguration(moduleOptions),
|
|
96
|
+
// Just like in Vite plugins you can use this hook to extend the user config
|
|
88
97
|
config(config) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
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: [
|
|
97
105
|
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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" }
|
|
114
122
|
}
|
|
115
|
-
]
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
} 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;
|
|
166
173
|
}
|
|
167
174
|
}
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
175
|
+
} catch (err) {
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
page.rendered = doc.outerHTML;
|
|
174
181
|
};
|
|
175
182
|
}
|
|
176
183
|
};
|
package/dist/index.js
CHANGED
|
@@ -7,8 +7,9 @@ async function getViteConfiguration(moduleOptions) {
|
|
|
7
7
|
var _a;
|
|
8
8
|
let vitePlugin;
|
|
9
9
|
try {
|
|
10
|
-
const { liveDesigner } = await import("./live-designer-
|
|
10
|
+
const { liveDesigner } = await import("./live-designer-6WHNERBU.js");
|
|
11
11
|
vitePlugin = liveDesigner({
|
|
12
|
+
/* mappingType: 'type3', */
|
|
12
13
|
tailwindcss: {
|
|
13
14
|
configPath: "tailwind.config.js",
|
|
14
15
|
cssPath: "@/assets/css/tailwind.css",
|
|
@@ -61,17 +62,24 @@ async function getViteConfiguration(moduleOptions) {
|
|
|
61
62
|
return mergeConfigRecursively(defaults || {}, overrides || {});
|
|
62
63
|
};
|
|
63
64
|
(_a = config.plugins) == null ? void 0 : _a.push(
|
|
65
|
+
// autoImportComponents(mergeConfig({}, moduleOptions.autoImportComponents)),
|
|
64
66
|
autoImportAPIs(
|
|
65
67
|
mergeConfig(
|
|
66
68
|
{
|
|
67
69
|
include: [
|
|
68
70
|
/\.[tj]sx?$/,
|
|
71
|
+
// .ts, .tsx, .js, .jsx
|
|
69
72
|
/\.vue$/,
|
|
70
73
|
/\.vue\?vue/,
|
|
74
|
+
// .vue
|
|
71
75
|
/\.md$/
|
|
76
|
+
// .md
|
|
72
77
|
],
|
|
73
78
|
imports: ["vue", "vue-router"],
|
|
74
|
-
dirs: [
|
|
79
|
+
dirs: [
|
|
80
|
+
// 'src/composables',
|
|
81
|
+
// 'src/stores',
|
|
82
|
+
],
|
|
75
83
|
vueTemplate: true,
|
|
76
84
|
cache: true
|
|
77
85
|
},
|
|
@@ -85,92 +93,91 @@ async function src_default(moduleOptions) {
|
|
|
85
93
|
return {
|
|
86
94
|
name: "@pinegrow/iles-module",
|
|
87
95
|
vite: await getViteConfiguration(moduleOptions),
|
|
96
|
+
// Just like in Vite plugins you can use this hook to extend the user config
|
|
88
97
|
config(config) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
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: [
|
|
97
105
|
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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" }
|
|
114
122
|
}
|
|
115
|
-
]
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
} 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;
|
|
166
173
|
}
|
|
167
174
|
}
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
175
|
+
} catch (err) {
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
page.rendered = doc.outerHTML;
|
|
174
181
|
};
|
|
175
182
|
}
|
|
176
183
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/live-designer.mjs
|
|
2
|
+
var _viteplugin = require('@pinegrow/vite-plugin'); var _viteplugin2 = _interopRequireDefault(_viteplugin);
|
|
3
|
+
var liveDesigner = _viteplugin2.default.liveDesigner;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
exports.liveDesigner = liveDesigner;
|
|
7
|
+
/*! import { liveDesigner } from '@pinegrow/vite-plugin/dev' */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinegrow/iles-module",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
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,16 +31,13 @@
|
|
|
31
31
|
"increment-beta-version": "npm version prerelease --preid=beta"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@pinegrow/vite-plugin": "3.0.0-beta.
|
|
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
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"iles": "^0.
|
|
40
|
-
"tsup": "^
|
|
41
|
-
"typescript": "^4.
|
|
42
|
-
},
|
|
43
|
-
"peerDependencies": {
|
|
44
|
-
"iles": "^0.5"
|
|
39
|
+
"iles": "^0.8",
|
|
40
|
+
"tsup": "^6.2",
|
|
41
|
+
"typescript": "^4.7"
|
|
45
42
|
}
|
|
46
43
|
}
|