@pinegrow/iles-module 3.0.0-beta.99 → 3.0.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/README.md CHANGED
@@ -1,6 +1,73 @@
1
- # @pinegrow/iles-module
1
+ <!-- [![@pinegrow/iles-module](https://tailwindcss.nuxtjs.org/social-card.png)](https://tailwindcss.nuxtjs.org) -->
2
2
 
3
- ## Pinegrow Iles module
3
+ # Pinegrow Iles Module
4
4
 
5
- http://www.pinegrow.com
5
+ [![npm version][npm-version-src]][npm-version-href]
6
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
7
+ [![License][license-src]][license-href]
8
+
9
+ [Iles](https://iles.pages.dev/) module for [Pinegrow](https://pinegrow.com) ⚡️
10
+
11
+ Pinegrow Iles Module enables connection and interaction between your Vite Dev-Server and Pinegrow apps (currently only Vue Designer).
12
+
13
+ - [&nbsp;Learn more about Vue Designer](https://vuedesigner.com)
14
+
15
+ ## Features
16
+
17
+ - 🎨&nbsp; Visually live-design your Vite-powered Iles apps
18
+ - ⚙️&nbsp; Smartly integrates into your Iles workflow in dev-mode only
19
+ - ✨&nbsp; Clean code 😃, No lock-in - You are in control of your projects and development workflow ❤️
20
+
21
+ ## Quick Setup
22
+
23
+ 1. Install: Add `@pinegrow/iles-module` to your project
24
+
25
+ ```bash
26
+ # Using npm
27
+ npm install -D @pinegrow/iles-module
28
+
29
+ # Using pnpm
30
+ pnpm add -D @pinegrow/iles-module
31
+ ```
32
+
33
+ 2. Configure: Add `@pinegrow/iles-module` to your Iles Integrations array `iles.config.{js,ts}`
34
+
35
+ ```js
36
+ //iles.config.js (or) iles.config.ts
37
+
38
+ import { defineConfig } from 'iles'
39
+
40
+ export default defineConfig({
41
+ modules: [
42
+ [
43
+ '@pinegrow/iles-module',
44
+ {
45
+ liveDesigner: {
46
+ // For options, refer to https://www.npmjs.com/package/@pinegrow/vite-plugin
47
+ //...
48
+ },
49
+ },
50
+ ],
51
+ //...
52
+ ],
53
+ //...
54
+ })
55
+ ```
56
+
57
+ Now, open your project in your Pinegrow app (currently only Vue Designer). ✨
58
+
59
+ ## License
60
+
61
+ [MIT License](./LICENSE)
62
+
63
+ Copyright (c) Pinegrow
64
+
65
+ <!-- Badges -->
66
+
67
+ [npm-version-src]: https://img.shields.io/npm/v/@pinegrow/iles-module/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
68
+ [npm-version-href]: https://npmjs.com/package/@pinegrow/iles-module
69
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@pinegrow/iles-module.svg?style=flat&colorA=18181B&colorB=28CF8D
70
+ [npm-downloads-href]: https://npmjs.com/package/@pinegrow/iles-module
71
+ [license-src]: https://img.shields.io/npm/l/@pinegrow/iles-module.svg?style=flat&colorA=18181B&colorB=28CF8D
72
+ [license-href]: https://npmjs.com/package/@pinegrow/iles-module
6
73
 
package/dist/index.cjs CHANGED
@@ -1,14 +1,21 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/index.ts
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
2
  var _nodehtmlparser = require('node-html-parser'); var _nodehtmlparser2 = _interopRequireDefault(_nodehtmlparser);
3
3
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
4
4
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
5
- var _vite = require('unplugin-auto-import/vite'); var _vite2 = _interopRequireDefault(_vite);
6
5
  async function getViteConfiguration(moduleOptions) {
7
- var _a;
8
6
  let vitePlugin;
9
7
  try {
10
- const { liveDesigner } = await Promise.resolve().then(() => require("./live-designer-PEHWBCFL.cjs"));
11
- vitePlugin = liveDesigner(moduleOptions == null ? void 0 : moduleOptions.liveDesigner);
8
+ const { liveDesigner } = await Promise.resolve().then(() => _interopRequireWildcard(require("./live-designer-6F4BNNQY.cjs")));
9
+ 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
+ ...(moduleOptions == null ? void 0 : moduleOptions.liveDesigner) || {}
18
+ });
12
19
  } catch (err) {
13
20
  console.log(err);
14
21
  console.log("Pinegrow: @pinegrow/iles-module was unable to load @pinegrow/vite-plugin live-designer!");
@@ -49,120 +56,99 @@ async function getViteConfiguration(moduleOptions) {
49
56
  }
50
57
  return merged;
51
58
  };
52
- const mergeConfig = (defaults, overrides) => {
53
- return mergeConfigRecursively(defaults || {}, overrides || {});
54
- };
55
- (_a = config.plugins) == null ? void 0 : _a.push(
56
- _vite2.default.call(void 0,
57
- mergeConfig(
58
- {
59
- include: [
60
- /\.[tj]sx?$/,
61
- /\.vue$/,
62
- /\.vue\?vue/,
63
- /\.md$/
64
- ],
65
- imports: ["vue", "vue-router"],
66
- dirs: [],
67
- vueTemplate: true,
68
- cache: true
69
- },
70
- moduleOptions.autoImportAPIs
71
- )
72
- )
73
- );
74
59
  return config;
75
60
  }
76
61
  async function src_default(moduleOptions) {
77
62
  return {
78
63
  name: "@pinegrow/iles-module",
79
64
  vite: await getViteConfiguration(moduleOptions),
65
+ // Just like in Vite plugins you can use this hook to extend the user config
80
66
  config(config) {
81
- return {
82
- vue: {
83
- reactivityTransform: false
84
- },
85
- ssg: {
86
- beforePageRender: (page) => {
87
- const doc = _nodehtmlparser2.default.parse(page.rendered, "text/html");
88
- const addons = [
67
+ config.ssg.beforePageRender = (page) => {
68
+ const doc = _nodehtmlparser2.default.parse(page.rendered, "text/html");
69
+ const addons = [
70
+ {
71
+ name: "pgia",
72
+ resources: [
89
73
  {
90
- name: "pgia",
91
- resources: [
92
- {
93
- parentResource: `public/pgia`,
94
- injectTo: "head-append",
95
- tag: "script",
96
- children: `
97
- /* 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);}})()`
98
- },
99
- {
100
- parentResource: `public/pgia`,
101
- injectTo: "body-append",
102
- tag: "script",
103
- attrs: { src: "/pgia/lib/index.js" }
104
- }
105
- ]
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" }
106
90
  }
107
- ];
108
- addons.forEach((addon) => {
109
- addon.resources.forEach((resource) => {
110
- if (!resource.condition) {
111
- try {
112
- let parentResourceExists = true;
113
- if (resource.parentResource) {
114
- const projectRoot = process.cwd();
115
- const resourcePath = _path2.default.resolve(projectRoot, resource.parentResource);
116
- parentResourceExists = parentResourceExists && _fs2.default.existsSync(resourcePath);
117
- }
118
- if (parentResourceExists) {
119
- const attrContent = Object.entries(resource.attrs || {}).reduce(
120
- (acc, [key, value]) => {
121
- return `${acc}${key}${value && value !== true ? `="${value}"` : ""}`;
122
- },
123
- ""
124
- );
125
- let parentNode, sourceNode;
126
- switch (resource.injectTo) {
127
- case "head-prepend":
128
- parentNode = doc.querySelector("head");
129
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
130
- ${resource.children || ""}
131
- </${resource.tag}>`);
132
- parentNode.childNodes.unshift(sourceNode);
133
- break;
134
- case "head-append":
135
- parentNode = doc.querySelector("head");
136
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
137
- ${resource.children || ""}
138
- </${resource.tag}>`);
139
- parentNode.appendChild(sourceNode);
140
- break;
141
- case "body-prepend":
142
- parentNode = doc.querySelector("body");
143
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
144
- ${resource.children || ""}
145
- </${resource.tag}>`);
146
- parentNode.childNodes.unshift(sourceNode);
147
- break;
148
- case "body-append":
149
- parentNode = doc.querySelector("body");
150
- sourceNode = _nodehtmlparser2.default.parse(`<${resource.tag} ${attrContent}>
151
- ${resource.children || ""}
152
- </${resource.tag}>`);
153
- parentNode.appendChild(sourceNode);
154
- break;
155
- }
156
- }
157
- } catch (err) {
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;
158
144
  }
159
145
  }
160
- });
161
- });
162
- page.rendered = doc.outerHTML;
163
- }
164
- },
165
- ...config
146
+ } catch (err) {
147
+ }
148
+ }
149
+ });
150
+ });
151
+ page.rendered = doc.outerHTML;
166
152
  };
167
153
  }
168
154
  };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { IlesModule } from 'iles';
2
- import AutoImportAPIs from 'unplugin-auto-import/types';
2
+ import { PinegrowVitePlugin } from '@pinegrow/vite-plugin';
3
3
 
4
+ interface PinegrowIlesModuleOptions {
5
+ pinegrow: PinegrowVitePlugin;
6
+ }
4
7
  /**
5
8
  * An iles module that...
6
9
  */
7
- declare function export_default(moduleOptions: {
8
- liveDesigner: any;
9
- autoImportAPIs: ReturnType<typeof AutoImportAPIs>;
10
- }): IlesModule;
10
+ declare function export_default(moduleOptions: PinegrowIlesModuleOptions): IlesModule;
11
11
 
12
- export { export_default as default };
12
+ export { PinegrowIlesModuleOptions, export_default as default };
package/dist/index.js CHANGED
@@ -2,13 +2,20 @@
2
2
  import htmlParser from "node-html-parser";
3
3
  import path from "path";
4
4
  import fs from "fs";
5
- import autoImportAPIs from "unplugin-auto-import/vite";
6
5
  async function getViteConfiguration(moduleOptions) {
7
- var _a;
8
6
  let vitePlugin;
9
7
  try {
10
- const { liveDesigner } = await import("./live-designer-TIVRM3WS.js");
11
- vitePlugin = liveDesigner(moduleOptions == null ? void 0 : moduleOptions.liveDesigner);
8
+ const { liveDesigner } = await import("./live-designer-6WHNERBU.js");
9
+ 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
+ ...(moduleOptions == null ? void 0 : moduleOptions.liveDesigner) || {}
18
+ });
12
19
  } catch (err) {
13
20
  console.log(err);
14
21
  console.log("Pinegrow: @pinegrow/iles-module was unable to load @pinegrow/vite-plugin live-designer!");
@@ -49,120 +56,99 @@ async function getViteConfiguration(moduleOptions) {
49
56
  }
50
57
  return merged;
51
58
  };
52
- const mergeConfig = (defaults, overrides) => {
53
- return mergeConfigRecursively(defaults || {}, overrides || {});
54
- };
55
- (_a = config.plugins) == null ? void 0 : _a.push(
56
- autoImportAPIs(
57
- mergeConfig(
58
- {
59
- include: [
60
- /\.[tj]sx?$/,
61
- /\.vue$/,
62
- /\.vue\?vue/,
63
- /\.md$/
64
- ],
65
- imports: ["vue", "vue-router"],
66
- dirs: [],
67
- vueTemplate: true,
68
- cache: true
69
- },
70
- moduleOptions.autoImportAPIs
71
- )
72
- )
73
- );
74
59
  return config;
75
60
  }
76
61
  async function src_default(moduleOptions) {
77
62
  return {
78
63
  name: "@pinegrow/iles-module",
79
64
  vite: await getViteConfiguration(moduleOptions),
65
+ // Just like in Vite plugins you can use this hook to extend the user config
80
66
  config(config) {
81
- return {
82
- vue: {
83
- reactivityTransform: false
84
- },
85
- ssg: {
86
- beforePageRender: (page) => {
87
- const doc = htmlParser.parse(page.rendered, "text/html");
88
- const addons = [
67
+ config.ssg.beforePageRender = (page) => {
68
+ const doc = htmlParser.parse(page.rendered, "text/html");
69
+ const addons = [
70
+ {
71
+ name: "pgia",
72
+ resources: [
89
73
  {
90
- name: "pgia",
91
- resources: [
92
- {
93
- parentResource: `public/pgia`,
94
- injectTo: "head-append",
95
- tag: "script",
96
- children: `
97
- /* 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);}})()`
98
- },
99
- {
100
- parentResource: `public/pgia`,
101
- injectTo: "body-append",
102
- tag: "script",
103
- attrs: { src: "/pgia/lib/index.js" }
104
- }
105
- ]
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" }
106
90
  }
107
- ];
108
- addons.forEach((addon) => {
109
- addon.resources.forEach((resource) => {
110
- if (!resource.condition) {
111
- try {
112
- let parentResourceExists = true;
113
- if (resource.parentResource) {
114
- const projectRoot = process.cwd();
115
- const resourcePath = path.resolve(projectRoot, resource.parentResource);
116
- parentResourceExists = parentResourceExists && fs.existsSync(resourcePath);
117
- }
118
- if (parentResourceExists) {
119
- const attrContent = Object.entries(resource.attrs || {}).reduce(
120
- (acc, [key, value]) => {
121
- return `${acc}${key}${value && value !== true ? `="${value}"` : ""}`;
122
- },
123
- ""
124
- );
125
- let parentNode, sourceNode;
126
- switch (resource.injectTo) {
127
- case "head-prepend":
128
- parentNode = doc.querySelector("head");
129
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
130
- ${resource.children || ""}
131
- </${resource.tag}>`);
132
- parentNode.childNodes.unshift(sourceNode);
133
- break;
134
- case "head-append":
135
- parentNode = doc.querySelector("head");
136
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
137
- ${resource.children || ""}
138
- </${resource.tag}>`);
139
- parentNode.appendChild(sourceNode);
140
- break;
141
- case "body-prepend":
142
- parentNode = doc.querySelector("body");
143
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
144
- ${resource.children || ""}
145
- </${resource.tag}>`);
146
- parentNode.childNodes.unshift(sourceNode);
147
- break;
148
- case "body-append":
149
- parentNode = doc.querySelector("body");
150
- sourceNode = htmlParser.parse(`<${resource.tag} ${attrContent}>
151
- ${resource.children || ""}
152
- </${resource.tag}>`);
153
- parentNode.appendChild(sourceNode);
154
- break;
155
- }
156
- }
157
- } catch (err) {
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;
158
144
  }
159
145
  }
160
- });
161
- });
162
- page.rendered = doc.outerHTML;
163
- }
164
- },
165
- ...config
146
+ } catch (err) {
147
+ }
148
+ }
149
+ });
150
+ });
151
+ page.rendered = doc.outerHTML;
166
152
  };
167
153
  }
168
154
  };
@@ -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' */
@@ -0,0 +1,7 @@
1
+ // src/live-designer.mjs
2
+ import pkg from "@pinegrow/vite-plugin";
3
+ var liveDesigner = pkg.liveDesigner;
4
+ export {
5
+ liveDesigner
6
+ };
7
+ /*! import { liveDesigner } from '@pinegrow/vite-plugin/dev' */
@@ -1,6 +1,7 @@
1
1
  // src/live-designer.mjs
2
- import pkg from "@pinegrow/vite-plugin";
3
- var liveDesigner = pkg.liveDesigner;
2
+ import { liveDesigner } from '@pinegrow/vite-plugin/dev'
3
+ // import pkg from "@pinegrow/vite-plugin";
4
+ // var liveDesigner = pkg.liveDesigner;
4
5
  export {
5
6
  liveDesigner
6
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinegrow/iles-module",
3
- "version": "3.0.0-beta.99",
3
+ "version": "3.0.1",
4
4
  "description": "Pinegrow Iles Module",
5
5
  "author": "Pinegrow (http://pinegrow.com/)",
6
6
  "license": "MIT",
@@ -14,13 +14,18 @@
14
14
  "exports": {
15
15
  "./package.json": "./package.json",
16
16
  ".": {
17
+ "types": "./dist/index.d.ts",
17
18
  "import": "./dist/index.js",
18
19
  "require": "./dist/index.cjs"
19
20
  }
20
21
  },
21
22
  "keywords": [
22
23
  "pinegrow",
23
- "iles-module"
24
+ "vue designer",
25
+ "vuedesigner",
26
+ "vue-designer",
27
+ "iles-module",
28
+ "@pinegrow/iles-module"
24
29
  ],
25
30
  "scripts": {
26
31
  "dev": "npm run build -- --watch",
@@ -31,16 +36,13 @@
31
36
  "increment-beta-version": "npm version prerelease --preid=beta"
32
37
  },
33
38
  "dependencies": {
34
- "@pinegrow/vite-plugin": "3.0.0-beta.100",
35
- "node-html-parser": "^6.1.5",
36
- "unplugin-auto-import": "^0.15.2"
39
+ "@pinegrow/vite-plugin": "3.0.1",
40
+ "node-html-parser": "^6.1.5"
37
41
  },
38
42
  "devDependencies": {
39
- "iles": "^0.5",
40
- "tsup": "^5.5.0",
41
- "typescript": "^4.4.4"
42
- },
43
- "peerDependencies": {
44
- "iles": "^0.5"
43
+ "iles": "^0.8",
44
+ "tsup": "^6.2",
45
+ "typescript": "^4.7"
45
46
  }
46
47
  }
48
+