@pinegrow/astro-module 3.0.0-beta.100

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # @pinegrow/astro-module
2
+
3
+ ## Pinegrow Astro module
4
+
5
+ http://www.pinegrow.com
6
+
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/tsup/assets/cjs_shims.js
2
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
3
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
4
+
5
+
6
+
7
+ exports.importMetaUrl = importMetaUrl;
@@ -0,0 +1,53 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined")
11
+ return require.apply(this, arguments);
12
+ throw new Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+ var __esm = (fn, res) => function __init() {
15
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
16
+ };
17
+ var __commonJS = (cb, mod) => function __require2() {
18
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // ../../node_modules/tsup/assets/esm_shims.js
34
+ import { fileURLToPath } from "url";
35
+ import path from "path";
36
+ var getFilename, getDirname, __dirname, __filename;
37
+ var init_esm_shims = __esm({
38
+ "../../node_modules/tsup/assets/esm_shims.js"() {
39
+ getFilename = () => fileURLToPath(import.meta.url);
40
+ getDirname = () => path.dirname(getFilename());
41
+ __dirname = /* @__PURE__ */ getDirname();
42
+ __filename = /* @__PURE__ */ getFilename();
43
+ }
44
+ });
45
+
46
+ export {
47
+ __require,
48
+ __commonJS,
49
+ __toESM,
50
+ __dirname,
51
+ __filename,
52
+ init_esm_shims
53
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined")
11
+ return require.apply(this, arguments);
12
+ throw new Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+ var __esm = (fn, res) => function __init() {
15
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
16
+ };
17
+ var __commonJS = (cb, mod) => function __require2() {
18
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // ../../node_modules/tsup/assets/cjs_shims.js
34
+ var init_cjs_shims = __esm({
35
+ "../../node_modules/tsup/assets/cjs_shims.js"() {
36
+ }
37
+ });
38
+
39
+
40
+
41
+
42
+
43
+
44
+ exports.__require = __require; exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.init_cjs_shims = init_cjs_shims;
package/dist/index.cjs ADDED
@@ -0,0 +1,129 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/index.ts
2
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
3
+ var _vite = require('unplugin-vue-components/vite'); var _vite2 = _interopRequireDefault(_vite);
4
+ var _vite3 = require('unplugin-auto-import/vite'); var _vite4 = _interopRequireDefault(_vite3);
5
+ async function getViteConfiguration(moduleOptions) {
6
+ var _a, _b, _c, _d;
7
+ let vitePlugin;
8
+ try {
9
+ const { liveDesigner } = await Promise.resolve().then(() => require("./live-designer-ZFVVYPVH.cjs"));
10
+ vitePlugin = liveDesigner({ ...(moduleOptions == null ? void 0 : moduleOptions.liveDesigner) || {} });
11
+ } catch (err) {
12
+ console.log(err);
13
+ console.log("Pinegrow: @pinegrow/astro-module was unable to load @pinegrow/vite-plugin live-designer!");
14
+ }
15
+ let config = {
16
+ plugins: vitePlugin ? [vitePlugin] : []
17
+ };
18
+ const isObject$1 = (value) => {
19
+ return Object.prototype.toString.call(value) === "[object Object]";
20
+ };
21
+ const arraify = (target) => {
22
+ return Array.isArray(target) ? target : [target];
23
+ };
24
+ const mergeConfigRecursively = (defaults, overrides) => {
25
+ const merged = { ...defaults };
26
+ for (const key in overrides) {
27
+ const value = overrides[key];
28
+ if (value == null) {
29
+ continue;
30
+ }
31
+ const existing = merged[key];
32
+ if (existing == null) {
33
+ merged[key] = value;
34
+ continue;
35
+ }
36
+ if (Array.isArray(existing) || Array.isArray(value)) {
37
+ merged[key] = [
38
+ ...arraify(existing !== null && existing !== void 0 ? existing : []),
39
+ ...arraify(value !== null && value !== void 0 ? value : [])
40
+ ];
41
+ continue;
42
+ }
43
+ if (isObject$1(existing) && isObject$1(value)) {
44
+ merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
45
+ continue;
46
+ }
47
+ merged[key] = value;
48
+ }
49
+ return merged;
50
+ };
51
+ const mergeConfig = (defaults, overrides) => {
52
+ return mergeConfigRecursively(defaults || {}, overrides || {});
53
+ };
54
+ (_a = config.plugins) == null ? void 0 : _a.push(
55
+ _vite2.default.call(void 0, mergeConfig({}, moduleOptions.autoImportComponents)),
56
+ _vite4.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
+ const ignoreList = [
75
+ .../* @__PURE__ */ new Set([...((_c = (_b = config == null ? void 0 : config.server) == null ? void 0 : _b.watch) == null ? void 0 : _c.ignored) || [], "**/_pgbackup/**", "**/_pginfo/**", "**/pinegrow.json"])
76
+ ];
77
+ config = mergeConfig(config, {
78
+ server: {
79
+ watch: {
80
+ ignored: ignoreList
81
+ }
82
+ }
83
+ });
84
+ const alias = (_d = config == null ? void 0 : config.resolve) == null ? void 0 : _d.alias;
85
+ if (!alias) {
86
+ config = mergeConfig(config, {
87
+ resolve: {
88
+ alias: {
89
+ "@": _path2.default.resolve(config.root || process.cwd(), "./src")
90
+ }
91
+ }
92
+ });
93
+ }
94
+ return config;
95
+ }
96
+ function createIntegration(moduleOptions) {
97
+ return {
98
+ name: "@pinegrow/astro-module",
99
+ hooks: {
100
+ "astro:config:setup": async ({ updateConfig }) => {
101
+ updateConfig({
102
+ vite: await getViteConfiguration(moduleOptions)
103
+ });
104
+ },
105
+ "astro:server:setup": ({ server }) => {
106
+ const liveDesignerPluginIndex = server.config.plugins.findIndex(
107
+ (plugin) => plugin.name === "pinegrow:live-designer"
108
+ );
109
+ const liveDesignerPlugin = server.config.plugins[liveDesignerPluginIndex];
110
+ server.config.plugins.splice(liveDesignerPluginIndex, 1);
111
+ const astroBuildIndex = server.config.plugins.findIndex((plugin) => plugin.name === "astro:build");
112
+ server.config.plugins.splice(astroBuildIndex, 0, liveDesignerPlugin);
113
+ const alias = server.config.resolve.alias.find((alias2) => alias2.find === "@");
114
+ const aliases = server.config.resolve.alias.filter((alias2) => alias2.find !== "@");
115
+ server.config.resolve.alias = [...aliases];
116
+ if (alias) {
117
+ server.config.resolve.alias.push(alias);
118
+ }
119
+ },
120
+ "astro:build:setup": ({ vite, pages, target }) => {
121
+ },
122
+ "astro:build:done": ({ dir, routes }) => {
123
+ }
124
+ }
125
+ };
126
+ }
127
+
128
+
129
+ exports.default = createIntegration;
@@ -0,0 +1,11 @@
1
+ import { AstroIntegration } from 'astro';
2
+ import AutoImportComponents from 'unplugin-vue-components/types';
3
+ import AutoImportAPIs from 'unplugin-auto-import/types';
4
+
5
+ declare function createIntegration(moduleOptions: {
6
+ liveDesigner: any;
7
+ autoImportComponents: ReturnType<typeof AutoImportComponents>;
8
+ autoImportAPIs: ReturnType<typeof AutoImportAPIs>;
9
+ }): AstroIntegration;
10
+
11
+ export { createIntegration as default };
package/dist/index.js ADDED
@@ -0,0 +1,129 @@
1
+ // src/index.ts
2
+ import path from "path";
3
+ import autoImportComponents from "unplugin-vue-components/vite";
4
+ import autoImportAPIs from "unplugin-auto-import/vite";
5
+ async function getViteConfiguration(moduleOptions) {
6
+ var _a, _b, _c, _d;
7
+ let vitePlugin;
8
+ try {
9
+ const { liveDesigner } = await import("./live-designer-LATOGT4K.js");
10
+ vitePlugin = liveDesigner({ ...(moduleOptions == null ? void 0 : moduleOptions.liveDesigner) || {} });
11
+ } catch (err) {
12
+ console.log(err);
13
+ console.log("Pinegrow: @pinegrow/astro-module was unable to load @pinegrow/vite-plugin live-designer!");
14
+ }
15
+ let config = {
16
+ plugins: vitePlugin ? [vitePlugin] : []
17
+ };
18
+ const isObject$1 = (value) => {
19
+ return Object.prototype.toString.call(value) === "[object Object]";
20
+ };
21
+ const arraify = (target) => {
22
+ return Array.isArray(target) ? target : [target];
23
+ };
24
+ const mergeConfigRecursively = (defaults, overrides) => {
25
+ const merged = { ...defaults };
26
+ for (const key in overrides) {
27
+ const value = overrides[key];
28
+ if (value == null) {
29
+ continue;
30
+ }
31
+ const existing = merged[key];
32
+ if (existing == null) {
33
+ merged[key] = value;
34
+ continue;
35
+ }
36
+ if (Array.isArray(existing) || Array.isArray(value)) {
37
+ merged[key] = [
38
+ ...arraify(existing !== null && existing !== void 0 ? existing : []),
39
+ ...arraify(value !== null && value !== void 0 ? value : [])
40
+ ];
41
+ continue;
42
+ }
43
+ if (isObject$1(existing) && isObject$1(value)) {
44
+ merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
45
+ continue;
46
+ }
47
+ merged[key] = value;
48
+ }
49
+ return merged;
50
+ };
51
+ const mergeConfig = (defaults, overrides) => {
52
+ return mergeConfigRecursively(defaults || {}, overrides || {});
53
+ };
54
+ (_a = config.plugins) == null ? void 0 : _a.push(
55
+ autoImportComponents(mergeConfig({}, moduleOptions.autoImportComponents)),
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
+ const ignoreList = [
75
+ .../* @__PURE__ */ new Set([...((_c = (_b = config == null ? void 0 : config.server) == null ? void 0 : _b.watch) == null ? void 0 : _c.ignored) || [], "**/_pgbackup/**", "**/_pginfo/**", "**/pinegrow.json"])
76
+ ];
77
+ config = mergeConfig(config, {
78
+ server: {
79
+ watch: {
80
+ ignored: ignoreList
81
+ }
82
+ }
83
+ });
84
+ const alias = (_d = config == null ? void 0 : config.resolve) == null ? void 0 : _d.alias;
85
+ if (!alias) {
86
+ config = mergeConfig(config, {
87
+ resolve: {
88
+ alias: {
89
+ "@": path.resolve(config.root || process.cwd(), "./src")
90
+ }
91
+ }
92
+ });
93
+ }
94
+ return config;
95
+ }
96
+ function createIntegration(moduleOptions) {
97
+ return {
98
+ name: "@pinegrow/astro-module",
99
+ hooks: {
100
+ "astro:config:setup": async ({ updateConfig }) => {
101
+ updateConfig({
102
+ vite: await getViteConfiguration(moduleOptions)
103
+ });
104
+ },
105
+ "astro:server:setup": ({ server }) => {
106
+ const liveDesignerPluginIndex = server.config.plugins.findIndex(
107
+ (plugin) => plugin.name === "pinegrow:live-designer"
108
+ );
109
+ const liveDesignerPlugin = server.config.plugins[liveDesignerPluginIndex];
110
+ server.config.plugins.splice(liveDesignerPluginIndex, 1);
111
+ const astroBuildIndex = server.config.plugins.findIndex((plugin) => plugin.name === "astro:build");
112
+ server.config.plugins.splice(astroBuildIndex, 0, liveDesignerPlugin);
113
+ const alias = server.config.resolve.alias.find((alias2) => alias2.find === "@");
114
+ const aliases = server.config.resolve.alias.filter((alias2) => alias2.find !== "@");
115
+ server.config.resolve.alias = [...aliases];
116
+ if (alias) {
117
+ server.config.resolve.alias.push(alias);
118
+ }
119
+ },
120
+ "astro:build:setup": ({ vite, pages, target }) => {
121
+ },
122
+ "astro:build:done": ({ dir, routes }) => {
123
+ }
124
+ }
125
+ };
126
+ }
127
+ export {
128
+ createIntegration as default
129
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('./chunk-4NKIVEY7.cjs');
2
+
3
+ // src/live-designer.mjs
4
+ var _viteplugin = require('@pinegrow/vite-plugin'); var _viteplugin2 = _interopRequireDefault(_viteplugin);
5
+ var liveDesigner = _viteplugin2.default.liveDesigner;
6
+
7
+
8
+ exports.liveDesigner = liveDesigner;
@@ -0,0 +1,5 @@
1
+ // src/live-designer.mjs
2
+ import { liveDesigner } from "@pinegrow/vite-plugin";
3
+ export {
4
+ liveDesigner
5
+ };
@@ -0,0 +1,6 @@
1
+ // src/live-designer.mjs
2
+ import pkg from "@pinegrow/vite-plugin";
3
+ var liveDesigner = pkg.liveDesigner;
4
+ export {
5
+ liveDesigner
6
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ init_esm_shims
3
+ } from "./chunk-FOBIONE4.js";
4
+
5
+ // src/live-designer.mjs
6
+ init_esm_shims();
7
+ import pkg from "@pinegrow/vite-plugin";
8
+ var liveDesigner = pkg.liveDesigner;
9
+ export {
10
+ liveDesigner
11
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/live-designer.mjs
2
+ var _viteplugin = require('@pinegrow/vite-plugin');
3
+
4
+
5
+ exports.liveDesigner = _viteplugin.liveDesigner;
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+ var _chunkXPHVRMSYcjs = require('./chunk-XPHVRMSY.cjs');
4
+
5
+ // src/live-designer.mjs
6
+ _chunkXPHVRMSYcjs.init_cjs_shims.call(void 0, );
7
+ var _viteplugin = require('@pinegrow/vite-plugin'); var _viteplugin2 = _interopRequireDefault(_viteplugin);
8
+ var liveDesigner = _viteplugin2.default.liveDesigner;
9
+
10
+
11
+ exports.liveDesigner = liveDesigner;
@@ -0,0 +1,6 @@
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;
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@pinegrow/astro-module",
3
+ "version": "3.0.0-beta.100",
4
+ "description": "Pinegrow Astro Module",
5
+ "author": "Pinegrow (http://pinegrow.com/)",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "types": "./dist/index.d.ts",
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.cjs",
14
+ "exports": {
15
+ "./package.json": "./package.json",
16
+ ".": {
17
+ "import": "./dist/index.js",
18
+ "require": "./dist/index.cjs"
19
+ }
20
+ },
21
+ "keywords": [
22
+ "pinegrow",
23
+ "astro-module"
24
+ ],
25
+ "scripts": {
26
+ "dev": "npm run build -- --watch",
27
+ "build": "tsup src/index.ts",
28
+ "prepublishOnly": "npm run build",
29
+ "release": "npx bumpp --commit --tag --push && npm publish --access public",
30
+ "publish-beta": "npm run increment-beta-version && npm publish",
31
+ "increment-beta-version": "npm version prerelease --preid=beta"
32
+ },
33
+ "dependencies": {
34
+ "@pinegrow/vite-plugin": "3.0.0-beta.100",
35
+ "unplugin-vue-components": "^0.24.1",
36
+ "unplugin-auto-import": "^0.15.2"
37
+ },
38
+ "devDependencies": {
39
+ "astro": "^2.1.5",
40
+ "tsup": "^5.5.0",
41
+ "typescript": "^4.4.4"
42
+ },
43
+ "peerDependencies": {
44
+ "@astrojs/vue": "^2.1.0",
45
+ "astro": "^2.1.5"
46
+ }
47
+ }