@bagelink/blox 1.13.4 → 1.14.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/CmsPageView.vue.d.ts.map +1 -1
- package/dist/PreviewApp-BrthGx2F.js +4 -0
- package/dist/PreviewApp-CV_Uh9-d.cjs +4 -0
- package/dist/PreviewApp.vue.d.ts.map +1 -1
- package/dist/PreviewApp.vue_vue_type_style_index_0_lang-BkGWMbsE.js +185 -0
- package/dist/PreviewApp.vue_vue_type_style_index_0_lang-CFS05Itn.cjs +184 -0
- package/dist/PreviewRenderer.d.ts.map +1 -1
- package/dist/bridge.d.ts +1 -0
- package/dist/bridge.d.ts.map +1 -1
- package/dist/core-CPXNfJ-Z.js +460 -0
- package/dist/core-D1FiZJtz.cjs +459 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/createBloxApp.d.ts +107 -0
- package/dist/createBloxApp.d.ts.map +1 -0
- package/dist/defineBlock.d.ts +19 -4
- package/dist/defineBlock.d.ts.map +1 -1
- package/dist/index.cjs +87 -604
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +86 -602
- package/dist/{prerender-CjJwDXkC.cjs → prerender-Bi7YtzSp.cjs} +48 -46
- package/dist/{prerender-oMLxrKGs.js → prerender-D3Q4jKXm.js} +51 -49
- package/dist/schema.d.ts +2 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/ssg/cli.cjs +17 -5
- package/dist/ssg/cli.mjs +17 -5
- package/dist/ssg/client.cjs +9 -7
- package/dist/ssg/client.d.ts +1 -1
- package/dist/ssg/client.d.ts.map +1 -1
- package/dist/ssg/client.mjs +3 -1
- package/dist/ssg/createSSREntry.d.ts +73 -0
- package/dist/ssg/createSSREntry.d.ts.map +1 -0
- package/dist/ssg/index.cjs +116 -8
- package/dist/ssg/index.d.ts +2 -0
- package/dist/ssg/index.d.ts.map +1 -1
- package/dist/ssg/index.mjs +93 -6
- package/dist/ssg/prerender.d.ts.map +1 -1
- package/dist/style.css +5 -46
- package/dist/vite-plugin.cjs +142 -3
- package/dist/vite-plugin.d.ts +22 -21
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.mjs +142 -3
- package/package.json +4 -1
- package/dist/PreviewApp-BZNzZkit.js +0 -4
- package/dist/PreviewApp-C1WvJWI4.cjs +0 -4
- package/dist/constants-BjitNk-W.js +0 -8
- package/dist/constants-CFB_pMvT.cjs +0 -7
package/dist/vite-plugin.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { join, dirname } from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
1
4
|
var comma = ",".charCodeAt(0);
|
|
2
5
|
var semicolon = ";".charCodeAt(0);
|
|
3
6
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -1067,8 +1070,143 @@ class MagicString {
|
|
|
1067
1070
|
return this._replaceRegexp(searchValue, replacement);
|
|
1068
1071
|
}
|
|
1069
1072
|
}
|
|
1070
|
-
function bloxPlugin() {
|
|
1071
|
-
|
|
1073
|
+
function bloxPlugin(options = {}) {
|
|
1074
|
+
const enableSSR = options.ssr ?? false;
|
|
1075
|
+
const plugins = [];
|
|
1076
|
+
if (enableSSR) {
|
|
1077
|
+
plugins.push({
|
|
1078
|
+
name: "vite-plugin-blox-ssr",
|
|
1079
|
+
enforce: "pre",
|
|
1080
|
+
config(_config, { command }) {
|
|
1081
|
+
const cwd = process.cwd();
|
|
1082
|
+
function resolveVuePaths() {
|
|
1083
|
+
const bases = [join(cwd, "..", "package.json"), join(cwd, "package.json")];
|
|
1084
|
+
for (const base of bases) {
|
|
1085
|
+
try {
|
|
1086
|
+
const req = createRequire(base);
|
|
1087
|
+
const vueEntry = req.resolve("vue");
|
|
1088
|
+
const vueDir = dirname(dirname(vueEntry));
|
|
1089
|
+
return {
|
|
1090
|
+
"vue": vueEntry,
|
|
1091
|
+
"vue/server-renderer": join(vueDir, "server-renderer", "index.mjs"),
|
|
1092
|
+
"@vue/server-renderer": req.resolve("@vue/server-renderer")
|
|
1093
|
+
};
|
|
1094
|
+
} catch {
|
|
1095
|
+
continue;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
return {};
|
|
1099
|
+
}
|
|
1100
|
+
const dedupe = [
|
|
1101
|
+
"vue",
|
|
1102
|
+
"vue-router",
|
|
1103
|
+
"@vue/runtime-core",
|
|
1104
|
+
"@vue/runtime-dom",
|
|
1105
|
+
"@vue/reactivity",
|
|
1106
|
+
"pinia"
|
|
1107
|
+
];
|
|
1108
|
+
const alias = resolveVuePaths();
|
|
1109
|
+
const ssrConfig = {
|
|
1110
|
+
resolve: {
|
|
1111
|
+
dedupe,
|
|
1112
|
+
alias
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
return ssrConfig;
|
|
1116
|
+
}
|
|
1117
|
+
});
|
|
1118
|
+
plugins.push({
|
|
1119
|
+
name: "vite-plugin-blox-ssr-build",
|
|
1120
|
+
enforce: "pre",
|
|
1121
|
+
config(config) {
|
|
1122
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1123
|
+
if ((_a = config.build) == null ? void 0 : _a.ssr) {
|
|
1124
|
+
return {
|
|
1125
|
+
build: {
|
|
1126
|
+
rollupOptions: {
|
|
1127
|
+
input: ((_c = (_b = config.build) == null ? void 0 : _b.rollupOptions) == null ? void 0 : _c.input) ?? "src/main.server.ts",
|
|
1128
|
+
output: ((_e = (_d = config.build) == null ? void 0 : _d.rollupOptions) == null ? void 0 : _e.output) ?? {
|
|
1129
|
+
dir: "dist/server",
|
|
1130
|
+
format: "esm"
|
|
1131
|
+
},
|
|
1132
|
+
external: [
|
|
1133
|
+
"vue",
|
|
1134
|
+
"vue-router",
|
|
1135
|
+
"vue/server-renderer",
|
|
1136
|
+
"@vue/server-renderer",
|
|
1137
|
+
...Array.isArray((_g = (_f = config.build) == null ? void 0 : _f.rollupOptions) == null ? void 0 : _g.external) ? config.build.rollupOptions.external : []
|
|
1138
|
+
]
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
return {};
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
if (options.autoCollections ?? false) {
|
|
1148
|
+
const discoveredCollections = /* @__PURE__ */ new Map();
|
|
1149
|
+
const VIRTUAL_ID = "virtual:blox-collections";
|
|
1150
|
+
const RESOLVED_VIRTUAL_ID = `\0${VIRTUAL_ID}`;
|
|
1151
|
+
plugins.push({
|
|
1152
|
+
name: "vite-plugin-blox-collections",
|
|
1153
|
+
enforce: "pre",
|
|
1154
|
+
resolveId(id) {
|
|
1155
|
+
if (id === VIRTUAL_ID) return RESOLVED_VIRTUAL_ID;
|
|
1156
|
+
},
|
|
1157
|
+
load(id) {
|
|
1158
|
+
if (id === RESOLVED_VIRTUAL_ID) {
|
|
1159
|
+
const entries = [...discoveredCollections.values()];
|
|
1160
|
+
return `export default ${JSON.stringify(entries)}`;
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
transform(code, id) {
|
|
1164
|
+
if (!id.endsWith(".vue")) return;
|
|
1165
|
+
const namePatterns = [
|
|
1166
|
+
/collectionName\s*:\s*['"]([^'"]+)['"]/g,
|
|
1167
|
+
/collection_name\s*:\s*['"]([^'"]+)['"]/g,
|
|
1168
|
+
/collection\s*:\s*['"]([^'"]+)['"]/g
|
|
1169
|
+
];
|
|
1170
|
+
const storeRe = /store\s*:\s*['"]([^'"]+)['"]/g;
|
|
1171
|
+
const stores = [];
|
|
1172
|
+
let storeMatch;
|
|
1173
|
+
while ((storeMatch = storeRe.exec(code)) !== null) {
|
|
1174
|
+
stores.push(storeMatch[1]);
|
|
1175
|
+
}
|
|
1176
|
+
const listItemsRe = /listItems\s*\(\s*['"]([^'"]+)['"]/g;
|
|
1177
|
+
let listMatch;
|
|
1178
|
+
while ((listMatch = listItemsRe.exec(code)) !== null) {
|
|
1179
|
+
const collectionName = listMatch[1];
|
|
1180
|
+
const key = `*/${collectionName}`;
|
|
1181
|
+
if (!discoveredCollections.has(key)) {
|
|
1182
|
+
discoveredCollections.set(key, { store: "*", collection: collectionName });
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
for (const pattern of namePatterns) {
|
|
1186
|
+
let match;
|
|
1187
|
+
while ((match = pattern.exec(code)) !== null) {
|
|
1188
|
+
const collection = match[1];
|
|
1189
|
+
if (["name", "label", "icon", "description", "type"].includes(collection)) continue;
|
|
1190
|
+
const store = stores[0] ?? "*";
|
|
1191
|
+
const key = `${store}/${collection}`;
|
|
1192
|
+
if (!discoveredCollections.has(key)) {
|
|
1193
|
+
discoveredCollections.set(key, { store, collection });
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
generateBundle() {
|
|
1199
|
+
if (discoveredCollections.size === 0) return;
|
|
1200
|
+
const entries = [...discoveredCollections.values()];
|
|
1201
|
+
this.emitFile({
|
|
1202
|
+
type: "asset",
|
|
1203
|
+
fileName: ".blox-collections.json",
|
|
1204
|
+
source: JSON.stringify(entries, null, 2)
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
plugins.push({
|
|
1072
1210
|
name: "vite-plugin-blox",
|
|
1073
1211
|
enforce: "pre",
|
|
1074
1212
|
transform(code, id) {
|
|
@@ -1161,7 +1299,8 @@ ${openTag}${remaining}${closeTag}`;
|
|
|
1161
1299
|
map: s.generateMap({ hires: true })
|
|
1162
1300
|
};
|
|
1163
1301
|
}
|
|
1164
|
-
};
|
|
1302
|
+
});
|
|
1303
|
+
return plugins;
|
|
1165
1304
|
}
|
|
1166
1305
|
export {
|
|
1167
1306
|
bloxPlugin
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagelink/blox",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.14.0",
|
|
5
5
|
"description": "Blox page builder library for drag-and-drop page building and static data management",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Bagel Studio",
|
|
@@ -123,5 +123,8 @@
|
|
|
123
123
|
"vue": "^3.5.32",
|
|
124
124
|
"vue-router": "^4.6.3",
|
|
125
125
|
"vue-tsc": "^2.0.0"
|
|
126
|
+
},
|
|
127
|
+
"dependencies": {
|
|
128
|
+
"pinia": "^3.0.4"
|
|
126
129
|
}
|
|
127
130
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const BLOX_STATE_WINDOW_KEY = "__BLOX_STATE__";
|
|
2
|
-
const BLOX_COLLECTIONS_WINDOW_KEY = "__BLOX_COLLECTIONS__";
|
|
3
|
-
const BLOX_WEBSITE_ID_WINDOW_KEY = "__BLOX_WEBSITE_ID__";
|
|
4
|
-
export {
|
|
5
|
-
BLOX_STATE_WINDOW_KEY as B,
|
|
6
|
-
BLOX_COLLECTIONS_WINDOW_KEY as a,
|
|
7
|
-
BLOX_WEBSITE_ID_WINDOW_KEY as b
|
|
8
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const BLOX_STATE_WINDOW_KEY = "__BLOX_STATE__";
|
|
3
|
-
const BLOX_COLLECTIONS_WINDOW_KEY = "__BLOX_COLLECTIONS__";
|
|
4
|
-
const BLOX_WEBSITE_ID_WINDOW_KEY = "__BLOX_WEBSITE_ID__";
|
|
5
|
-
exports.BLOX_COLLECTIONS_WINDOW_KEY = BLOX_COLLECTIONS_WINDOW_KEY;
|
|
6
|
-
exports.BLOX_STATE_WINDOW_KEY = BLOX_STATE_WINDOW_KEY;
|
|
7
|
-
exports.BLOX_WEBSITE_ID_WINDOW_KEY = BLOX_WEBSITE_ID_WINDOW_KEY;
|