mechanica 2.1.0-beta.3 → 2.1.0-beta.4
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/chunks/{node-adapter-CSZY47h6.js → node-adapter-BJbGKMgx.js} +2 -2
- package/dist/chunks/{rich-text-codec-D8JAuJIS.js → rich-text-codec-DcgyZKq_.js} +1 -1
- package/dist/chunks/{site-ONN3eU9_.js → site-DHrH4i9x.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/editor.js +4 -0
- package/dist/export.js +15 -1
- package/dist/plugin.js +3 -3
- package/dist/server.js +3 -3
- package/package.json +2 -2
- package/dist/types/vite/dev/middleware.d.ts +0 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as configureSite, r as indexGeneratedPages } from "./site-
|
|
2
|
-
import { A as pageVersion, C as harvestPageImages, D as movePage, E as listPages,
|
|
1
|
+
import { n as configureSite, r as indexGeneratedPages } from "./site-DHrH4i9x.js";
|
|
2
|
+
import { A as pageVersion, C as harvestPageImages, D as movePage, E as listPages, I as setPageDraft, J as storeUpload, K as listUploads, L as translationsOf, M as renamePage, N as savePage, R as contentFilesOf, T as listFolders, U as fsAssetStore, W as isAssetName, _ as deletePage, a as folderOf, b as fillContentDefaults, c as mergeLocaleSiteData, f as readSiteData, g as createTranslation, h as createPage, j as readPage, l as mergeSiteData, m as PageExistsError, o as mergeFolderData, s as mergeLocaleFolderData, u as readFolderData, v as deleteTranslation, w as imageNamesOf, x as fillImageMeta, y as duplicatePage } from "./rich-text-codec-DcgyZKq_.js";
|
|
3
3
|
import fs, { readFileSync, readdirSync } from "node:fs";
|
|
4
4
|
import { basename, extname, join, resolve, sep } from "node:path";
|
|
5
5
|
import { EDITOR_DIST_DIR, mergeTranslation, parseLocalePath, passDataToHTML, resolveQueryKey, serializeState } from "mechanica-shared";
|
|
@@ -1134,4 +1134,4 @@ function findRichTextProps(props) {
|
|
|
1134
1134
|
return found;
|
|
1135
1135
|
}
|
|
1136
1136
|
//#endregion
|
|
1137
|
-
export {
|
|
1137
|
+
export { hasSharp as $, pageVersion as A, memoryContentFiles as B, harvestPageImages as C, movePage as D, listPages as E, setPageCodec as F, isDerivedAsset as G, assetFileOf as H, setPageDraft as I, storeUpload as J, listUploads as K, translationsOf as L, renamePage as M, savePage as N, pageOfFile as O, setPageBlocks as P, analyzeImageBuffer as Q, contentFilesOf as R, getPagePath as S, listFolders as T, fsAssetStore as U, UPLOADS_PREFIX$1 as V, isAssetName as W, uploadName as X, updateImageManifest as Y, wasRecentlyMutated as Z, deletePage as _, folderOf as a, fillContentDefaults as b, mergeLocaleSiteData as c, readFoldersData as d, isRasterImage as et, readSiteData as f, createTranslation as g, createPage as h, toBlockMeta as i, readPage as j, pageUrlOf as k, mergeSiteData as l, PageExistsError as m, richTextCodecFromBlocks as n, mergeFolderData as o, readSiteLocaleOverride as p, readImageManifest as q, composedBlockMeta as r, mergeLocaleFolderData as s, buildRichTextCodec as t, readFolderData as u, deleteTranslation as v, imageNamesOf as w, fillImageMeta as x, duplicatePage as y, fsContentFiles as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as setPageCodec, P as setPageBlocks, i as toBlockMeta, n as richTextCodecFromBlocks, r as composedBlockMeta } from "./rich-text-codec-
|
|
1
|
+
import { F as setPageCodec, P as setPageBlocks, i as toBlockMeta, n as richTextCodecFromBlocks, r as composedBlockMeta } from "./rich-text-codec-DcgyZKq_.js";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { SITE_MANIFEST_FILE, areFieldSchemasRegistered, localePath, registerFieldSchemas } from "mechanica-shared";
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as buildSiteManifest } from "./chunks/site-
|
|
2
|
-
import { $ as
|
|
1
|
+
import { t as buildSiteManifest } from "./chunks/site-DHrH4i9x.js";
|
|
2
|
+
import { $ as hasSharp, G as isDerivedAsset, Q as analyzeImageBuffer, Y as updateImageManifest, et as isRasterImage, q as readImageManifest } from "./chunks/rich-text-codec-DcgyZKq_.js";
|
|
3
3
|
import { exportBuilt } from "./export.js";
|
|
4
4
|
import fs, { readFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join } from "node:path";
|
package/dist/editor.js
CHANGED
|
@@ -3355,6 +3355,10 @@ var saveQueue = createSaveQueue({
|
|
|
3355
3355
|
version: pageVersion
|
|
3356
3356
|
})
|
|
3357
3357
|
});
|
|
3358
|
+
window.__MECHANICA_EDITOR_API__ = {
|
|
3359
|
+
hasUnsaved: () => saveQueue.hasUnsaved(),
|
|
3360
|
+
flush: () => saveQueue.flush()
|
|
3361
|
+
};
|
|
3358
3362
|
window.addEventListener("beforeunload", (event) => {
|
|
3359
3363
|
if (saveQueue.flushOnUnload()) return;
|
|
3360
3364
|
event.preventDefault();
|
package/dist/export.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as listPages, F as setPageCodec,
|
|
1
|
+
import { $ as hasSharp, E as listPages, F as setPageCodec, G as isDerivedAsset, H as assetFileOf, Q as analyzeImageBuffer, S as getPagePath, V as UPLOADS_PREFIX$1, Y as updateImageManifest, d as readFoldersData, f as readSiteData, i as toBlockMeta, p as readSiteLocaleOverride, q as readImageManifest, r as composedBlockMeta, t as buildRichTextCodec, u as readFolderData } from "./chunks/rich-text-codec-DcgyZKq_.js";
|
|
2
2
|
import { n as blockAssetLinks, t as BLOCKS_MANIFEST_FILE } from "./chunks/page-assets-DsJXmoDs.js";
|
|
3
3
|
import { dirname, join, parse, relative, resolve } from "node:path";
|
|
4
4
|
import { EDITOR_DIST_DIR, SITE_MANIFEST_FILE, applySeoTags, auditPageHtml, buildRobotsTxt, buildSitemap, findUnknownBlocks, generateProject, isPaginatedQuery, localePath, mergeTranslation, migrateContent, paginationVariantPath, registerFieldSchemas, resolveQueryKey, templateBlockIds, validateLinks, walkSchema, walkTree } from "mechanica-shared";
|
|
@@ -435,12 +435,26 @@ async function exportProject(cwd, ssr, options = {}) {
|
|
|
435
435
|
onFile,
|
|
436
436
|
pageLinks
|
|
437
437
|
};
|
|
438
|
+
const unclaimed = /* @__PURE__ */ new Map();
|
|
439
|
+
for (const name of await readdir(join(cwd, ".mech/assets")).catch(() => [])) {
|
|
440
|
+
const spellings = [
|
|
441
|
+
name,
|
|
442
|
+
encodeURI(name),
|
|
443
|
+
encodeURIComponent(name)
|
|
444
|
+
].map((spelled) => UPLOADS_PREFIX$1 + spelled);
|
|
445
|
+
unclaimed.set(name, [...new Set(spellings)]);
|
|
446
|
+
}
|
|
438
447
|
const written = [];
|
|
439
448
|
const writePage = async (path, html) => {
|
|
440
449
|
const dir = path === "/" ? exportDir : join(exportDir, path);
|
|
441
450
|
await mkdir(dir, { recursive: true });
|
|
442
451
|
await writeFile(join(dir, "index.html"), html);
|
|
443
452
|
written.push(path);
|
|
453
|
+
for (const [name, addresses] of unclaimed) {
|
|
454
|
+
if (!addresses.some((address) => html.includes(address))) continue;
|
|
455
|
+
referenced.add(name);
|
|
456
|
+
unclaimed.delete(name);
|
|
457
|
+
}
|
|
444
458
|
};
|
|
445
459
|
const templateHandlesPagination = index.includes("page.pagination");
|
|
446
460
|
const pageNames = new Map(defaultPages.map((page) => [page.logicalPath, page.name ?? (page.logicalPath === "/" ? "Home" : page.logicalPath.split("/").pop())]));
|
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as collectGeneratedPages, n as configureSite, r as indexGeneratedPages, t as buildSiteManifest } from "./chunks/site-
|
|
2
|
-
import { a as renderEditablePage, c as fillStateImages, d as loadComposedDefinitions, n as toNodeMiddleware, o as buildGeneratedState, r as createEditorService, s as buildPageState, t as toAssetMiddleware, u as collectComposed } from "./chunks/node-adapter-
|
|
3
|
-
import {
|
|
1
|
+
import { a as collectGeneratedPages, n as configureSite, r as indexGeneratedPages, t as buildSiteManifest } from "./chunks/site-DHrH4i9x.js";
|
|
2
|
+
import { a as renderEditablePage, c as fillStateImages, d as loadComposedDefinitions, n as toNodeMiddleware, o as buildGeneratedState, r as createEditorService, s as buildPageState, t as toAssetMiddleware, u as collectComposed } from "./chunks/node-adapter-BJbGKMgx.js";
|
|
3
|
+
import { U as fsAssetStore, Z as wasRecentlyMutated, k as pageUrlOf } from "./chunks/rich-text-codec-DcgyZKq_.js";
|
|
4
4
|
import { t as BLOCKS_MANIFEST_FILE } from "./chunks/page-assets-DsJXmoDs.js";
|
|
5
5
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
6
6
|
import { join, relative } from "node:path";
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as readSiteManifest, n as configureSite, t as buildSiteManifest } from "./chunks/site-
|
|
2
|
-
import { a as renderEditablePage, i as readEditorTemplate, n as toNodeMiddleware, r as createEditorService, t as toAssetMiddleware } from "./chunks/node-adapter-
|
|
3
|
-
import { B as memoryContentFiles,
|
|
1
|
+
import { i as readSiteManifest, n as configureSite, t as buildSiteManifest } from "./chunks/site-DHrH4i9x.js";
|
|
2
|
+
import { a as renderEditablePage, i as readEditorTemplate, n as toNodeMiddleware, r as createEditorService, t as toAssetMiddleware } from "./chunks/node-adapter-BJbGKMgx.js";
|
|
3
|
+
import { B as memoryContentFiles, G as isDerivedAsset, O as pageOfFile, U as fsAssetStore, X as uploadName, z as fsContentFiles } from "./chunks/rich-text-codec-DcgyZKq_.js";
|
|
4
4
|
import { EDITOR_DIST_DIR, SITE_MANIFEST_FILE, UPLOADS_PREFIX, uploadNameOf } from "mechanica-shared";
|
|
5
5
|
export { EDITOR_DIST_DIR, SITE_MANIFEST_FILE, UPLOADS_PREFIX, buildSiteManifest, configureSite, createEditorService, fsAssetStore, fsContentFiles, isDerivedAsset, memoryContentFiles, pageOfFile, readEditorTemplate, readSiteManifest, renderEditablePage, toAssetMiddleware, toNodeMiddleware, uploadName, uploadNameOf };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mechanica",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.4",
|
|
4
4
|
"description": "Build Vue 3 websites with a visual block editor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"prepublishOnly": "bun ../../scripts/ensure-bun-publish.js && bun run build"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"mechanica-shared": "2.1.0-beta.
|
|
69
|
+
"mechanica-shared": "2.1.0-beta.4",
|
|
70
70
|
"@vue/compiler-sfc": "^3.5.38",
|
|
71
71
|
"compact-json-schema": "^0.1.5",
|
|
72
72
|
"estree-walker": "^3.0.3",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Connect } from 'vite';
|
|
2
|
-
import { type EditorServiceOptions } from '../../server/service';
|
|
3
|
-
export type { BlockListing } from '../../server/service';
|
|
4
|
-
export type DevMiddlewareOptions = EditorServiceOptions;
|
|
5
|
-
/**
|
|
6
|
-
* The `/@mechanica` dev middleware: the site's editor API (`src/server` —
|
|
7
|
-
* page CRUD, asset upload/serve, folder list, query resolution) over the local
|
|
8
|
-
* `.mech` store, mounted on Vite's connect stack. Mounted under the
|
|
9
|
-
* `/@mechanica` prefix, so `req.url` here is already prefix-stripped.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createDevMiddleware(mechDir: string, options?: DevMiddlewareOptions): Connect.NextHandleFunction;
|