@lowdefy/server-dev 5.1.0 → 5.2.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/lib/client/setPageId.js +3 -2
- package/lib/server/jitPageBuilder.js +6 -0
- package/manager/processes/startWatchers.mjs +2 -0
- package/manager/watchers/moduleBuildWatcher.mjs +80 -0
- package/package.json +29 -28
- package/package.original.json +34 -28
- package/pages/api/endpoints/{[endpointId].js → [...endpointId].js} +1 -1
- package/pages/api/page/{[pageId].js → [...pageId].js} +1 -1
- package/pages/api/request/{[pageId]/[requestId].js → [...path].js} +8 -2
- package/pages/index.js +0 -19
- /package/pages/{[pageId].js → [[...pageId]].js} +0 -0
package/lib/client/setPageId.js
CHANGED
|
@@ -18,13 +18,14 @@ function setPageId(router, rootConfig) {
|
|
|
18
18
|
if (router.pathname === `/404`) {
|
|
19
19
|
return { redirect: false, pageId: '404' };
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
const segments = router.query.pageId;
|
|
22
|
+
if (!segments || segments.length === 0) {
|
|
22
23
|
if (rootConfig.home.configured === false) {
|
|
23
24
|
return { redirect: true, pageId: rootConfig.home.pageId };
|
|
24
25
|
}
|
|
25
26
|
return { redirect: false, pageId: rootConfig.home.pageId };
|
|
26
27
|
}
|
|
27
|
-
return { redirect: false, pageId:
|
|
28
|
+
return { redirect: false, pageId: segments.join('/') };
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export default setPageId;
|
|
@@ -119,6 +119,12 @@ function getBuildContext(buildDirectory, configDirectory) {
|
|
|
119
119
|
readJsonFile(path.join(buildDirectory, 'installedPluginPackages.json')) ?? [];
|
|
120
120
|
cachedBuildContext.installedPluginPackages = new Set(installedPluginPackages);
|
|
121
121
|
|
|
122
|
+
// Restore module entries from skeleton build for JIT module page builds
|
|
123
|
+
const modules = readJsonFile(path.join(buildDirectory, 'modules.json'));
|
|
124
|
+
if (modules) {
|
|
125
|
+
Object.assign(cachedBuildContext.modules, modules);
|
|
126
|
+
}
|
|
127
|
+
|
|
122
128
|
// Use the frozen icon imports from the initial build for JIT detection.
|
|
123
129
|
// This represents what's actually in the Next.js bundle — not what shallowBuild
|
|
124
130
|
// discovers on subsequent rebuilds (those icons aren't bundled yet).
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import envWatcher from '../watchers/envWatcher.mjs';
|
|
18
18
|
import lowdefyBuildWatcher from '../watchers/lowdefyBuildWatcher.mjs';
|
|
19
|
+
import moduleBuildWatcher from '../watchers/moduleBuildWatcher.mjs';
|
|
19
20
|
import nextBuildWatcher from '../watchers/nextBuildWatcher.mjs';
|
|
20
21
|
|
|
21
22
|
function startWatchers(context) {
|
|
@@ -23,6 +24,7 @@ function startWatchers(context) {
|
|
|
23
24
|
await Promise.all([
|
|
24
25
|
envWatcher(context),
|
|
25
26
|
lowdefyBuildWatcher(context),
|
|
27
|
+
moduleBuildWatcher(context),
|
|
26
28
|
nextBuildWatcher(context),
|
|
27
29
|
]);
|
|
28
30
|
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import fs from 'fs';
|
|
18
|
+
import path from 'path';
|
|
19
|
+
import loadSkeletonSourceFiles from '../utils/loadSkeletonSourceFiles.mjs';
|
|
20
|
+
import setupWatcher from '../utils/setupWatcher.mjs';
|
|
21
|
+
|
|
22
|
+
function moduleBuildWatcher(context) {
|
|
23
|
+
// Collect local module directories from the build context
|
|
24
|
+
const buildContext = context.buildContext;
|
|
25
|
+
if (!buildContext || !buildContext.modules) {
|
|
26
|
+
return Promise.resolve();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const localModuleRoots = [];
|
|
30
|
+
for (const moduleEntry of Object.values(buildContext.modules)) {
|
|
31
|
+
if (moduleEntry.isLocal) {
|
|
32
|
+
localModuleRoots.push(moduleEntry.moduleRoot);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (localModuleRoots.length === 0) {
|
|
37
|
+
return Promise.resolve();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const callback = async (filePaths) => {
|
|
41
|
+
const changedFiles = filePaths.flat();
|
|
42
|
+
|
|
43
|
+
// If module.lowdefy.yaml itself changed, do a full shallow rebuild (module exports may have changed)
|
|
44
|
+
const moduleYamlChanged = changedFiles.some(
|
|
45
|
+
(filePath) => path.basename(filePath) === 'module.lowdefy.yaml'
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const skeletonSourceFiles = loadSkeletonSourceFiles(context.directories.build);
|
|
50
|
+
const hasSkeletonChanges = changedFiles.some((f) => skeletonSourceFiles.has(f));
|
|
51
|
+
|
|
52
|
+
if (moduleYamlChanged || hasSkeletonChanges) {
|
|
53
|
+
context.logger.info(
|
|
54
|
+
moduleYamlChanged
|
|
55
|
+
? 'module.lowdefy.yaml changed, running full shallow rebuild.'
|
|
56
|
+
: 'Module skeleton files changed, running shallow rebuild.'
|
|
57
|
+
);
|
|
58
|
+
await context.lowdefyBuild();
|
|
59
|
+
await context.compileCss();
|
|
60
|
+
} else {
|
|
61
|
+
const invalidatePath = path.join(context.directories.build, 'invalidatePages');
|
|
62
|
+
fs.writeFileSync(invalidatePath, String(Date.now()));
|
|
63
|
+
context.logger.info('Module files changed, invalidated all pages.');
|
|
64
|
+
}
|
|
65
|
+
} catch (error) {
|
|
66
|
+
context.logger.error(error);
|
|
67
|
+
} finally {
|
|
68
|
+
await context.reloadClients();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return setupWatcher({
|
|
73
|
+
callback,
|
|
74
|
+
context,
|
|
75
|
+
ignorePaths: ['**/node_modules/**'],
|
|
76
|
+
watchPaths: localModuleRoots,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default moduleBuildWatcher;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -36,33 +36,34 @@
|
|
|
36
36
|
".npmrc"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@lowdefy/actions-core": "5.
|
|
40
|
-
"@lowdefy/api": "5.
|
|
41
|
-
"@lowdefy/block-utils": "5.
|
|
42
|
-
"@lowdefy/blocks-aggrid": "5.
|
|
43
|
-
"@lowdefy/blocks-antd": "5.
|
|
44
|
-
"@lowdefy/blocks-basic": "5.
|
|
45
|
-
"@lowdefy/blocks-echarts": "5.
|
|
46
|
-
"@lowdefy/blocks-loaders": "5.
|
|
47
|
-
"@lowdefy/blocks-markdown": "5.
|
|
48
|
-
"@lowdefy/
|
|
49
|
-
"@lowdefy/
|
|
50
|
-
"@lowdefy/
|
|
51
|
-
"@lowdefy/
|
|
52
|
-
"@lowdefy/
|
|
53
|
-
"@lowdefy/
|
|
54
|
-
"@lowdefy/
|
|
55
|
-
"@lowdefy/
|
|
56
|
-
"@lowdefy/
|
|
57
|
-
"@lowdefy/
|
|
58
|
-
"@lowdefy/operators-
|
|
59
|
-
"@lowdefy/operators-
|
|
60
|
-
"@lowdefy/operators-
|
|
61
|
-
"@lowdefy/operators-
|
|
62
|
-
"@lowdefy/operators-
|
|
63
|
-
"@lowdefy/operators-
|
|
64
|
-
"@lowdefy/operators-
|
|
65
|
-
"@lowdefy/
|
|
39
|
+
"@lowdefy/actions-core": "5.2.0",
|
|
40
|
+
"@lowdefy/api": "5.2.0",
|
|
41
|
+
"@lowdefy/block-utils": "5.2.0",
|
|
42
|
+
"@lowdefy/blocks-aggrid": "5.2.0",
|
|
43
|
+
"@lowdefy/blocks-antd": "5.2.0",
|
|
44
|
+
"@lowdefy/blocks-basic": "5.2.0",
|
|
45
|
+
"@lowdefy/blocks-echarts": "5.2.0",
|
|
46
|
+
"@lowdefy/blocks-loaders": "5.2.0",
|
|
47
|
+
"@lowdefy/blocks-markdown": "5.2.0",
|
|
48
|
+
"@lowdefy/blocks-tiptap": "5.2.0",
|
|
49
|
+
"@lowdefy/build": "5.2.0",
|
|
50
|
+
"@lowdefy/client": "5.2.0",
|
|
51
|
+
"@lowdefy/connection-axios-http": "5.2.0",
|
|
52
|
+
"@lowdefy/engine": "5.2.0",
|
|
53
|
+
"@lowdefy/errors": "5.2.0",
|
|
54
|
+
"@lowdefy/helpers": "5.2.0",
|
|
55
|
+
"@lowdefy/layout": "5.2.0",
|
|
56
|
+
"@lowdefy/logger": "5.2.0",
|
|
57
|
+
"@lowdefy/node-utils": "5.2.0",
|
|
58
|
+
"@lowdefy/operators-change-case": "5.2.0",
|
|
59
|
+
"@lowdefy/operators-dayjs": "5.2.0",
|
|
60
|
+
"@lowdefy/operators-diff": "5.2.0",
|
|
61
|
+
"@lowdefy/operators-js": "5.2.0",
|
|
62
|
+
"@lowdefy/operators-mql": "5.2.0",
|
|
63
|
+
"@lowdefy/operators-nunjucks": "5.2.0",
|
|
64
|
+
"@lowdefy/operators-uuid": "5.2.0",
|
|
65
|
+
"@lowdefy/operators-yaml": "5.2.0",
|
|
66
|
+
"@lowdefy/plugin-next-auth": "5.2.0",
|
|
66
67
|
"@ant-design/cssinjs": "2.1.2",
|
|
67
68
|
"antd": "6.3.1",
|
|
68
69
|
"dayjs": "1.11.19",
|
package/package.original.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server-dev",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -44,33 +44,34 @@
|
|
|
44
44
|
"prepublishOnly": "pnpm build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@lowdefy/actions-core": "5.
|
|
48
|
-
"@lowdefy/api": "5.
|
|
49
|
-
"@lowdefy/block-utils": "5.
|
|
50
|
-
"@lowdefy/blocks-aggrid": "5.
|
|
51
|
-
"@lowdefy/blocks-antd": "5.
|
|
52
|
-
"@lowdefy/blocks-basic": "5.
|
|
53
|
-
"@lowdefy/blocks-echarts": "5.
|
|
54
|
-
"@lowdefy/blocks-loaders": "5.
|
|
55
|
-
"@lowdefy/blocks-markdown": "5.
|
|
56
|
-
"@lowdefy/
|
|
57
|
-
"@lowdefy/
|
|
58
|
-
"@lowdefy/
|
|
59
|
-
"@lowdefy/
|
|
60
|
-
"@lowdefy/
|
|
61
|
-
"@lowdefy/
|
|
62
|
-
"@lowdefy/
|
|
63
|
-
"@lowdefy/
|
|
64
|
-
"@lowdefy/
|
|
65
|
-
"@lowdefy/
|
|
66
|
-
"@lowdefy/operators-
|
|
67
|
-
"@lowdefy/operators-
|
|
68
|
-
"@lowdefy/operators-
|
|
69
|
-
"@lowdefy/operators-
|
|
70
|
-
"@lowdefy/operators-
|
|
71
|
-
"@lowdefy/operators-
|
|
72
|
-
"@lowdefy/operators-
|
|
73
|
-
"@lowdefy/
|
|
47
|
+
"@lowdefy/actions-core": "5.2.0",
|
|
48
|
+
"@lowdefy/api": "5.2.0",
|
|
49
|
+
"@lowdefy/block-utils": "5.2.0",
|
|
50
|
+
"@lowdefy/blocks-aggrid": "5.2.0",
|
|
51
|
+
"@lowdefy/blocks-antd": "5.2.0",
|
|
52
|
+
"@lowdefy/blocks-basic": "5.2.0",
|
|
53
|
+
"@lowdefy/blocks-echarts": "5.2.0",
|
|
54
|
+
"@lowdefy/blocks-loaders": "5.2.0",
|
|
55
|
+
"@lowdefy/blocks-markdown": "5.2.0",
|
|
56
|
+
"@lowdefy/blocks-tiptap": "5.2.0",
|
|
57
|
+
"@lowdefy/build": "5.2.0",
|
|
58
|
+
"@lowdefy/client": "5.2.0",
|
|
59
|
+
"@lowdefy/connection-axios-http": "5.2.0",
|
|
60
|
+
"@lowdefy/engine": "5.2.0",
|
|
61
|
+
"@lowdefy/errors": "5.2.0",
|
|
62
|
+
"@lowdefy/helpers": "5.2.0",
|
|
63
|
+
"@lowdefy/layout": "5.2.0",
|
|
64
|
+
"@lowdefy/logger": "5.2.0",
|
|
65
|
+
"@lowdefy/node-utils": "5.2.0",
|
|
66
|
+
"@lowdefy/operators-change-case": "5.2.0",
|
|
67
|
+
"@lowdefy/operators-dayjs": "5.2.0",
|
|
68
|
+
"@lowdefy/operators-diff": "5.2.0",
|
|
69
|
+
"@lowdefy/operators-js": "5.2.0",
|
|
70
|
+
"@lowdefy/operators-mql": "5.2.0",
|
|
71
|
+
"@lowdefy/operators-nunjucks": "5.2.0",
|
|
72
|
+
"@lowdefy/operators-uuid": "5.2.0",
|
|
73
|
+
"@lowdefy/operators-yaml": "5.2.0",
|
|
74
|
+
"@lowdefy/plugin-next-auth": "5.2.0",
|
|
74
75
|
"@ant-design/cssinjs": "2.1.2",
|
|
75
76
|
"antd": "6.3.1",
|
|
76
77
|
"dayjs": "1.11.19",
|
|
@@ -100,6 +101,11 @@
|
|
|
100
101
|
"engines": {
|
|
101
102
|
"node": ">=18"
|
|
102
103
|
},
|
|
104
|
+
"pnpm": {
|
|
105
|
+
"onlyBuiltDependencies": [
|
|
106
|
+
"better-sqlite3"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
103
109
|
"publishConfig": {
|
|
104
110
|
"access": "public"
|
|
105
111
|
}
|
|
@@ -22,7 +22,7 @@ async function handler({ context, req, res }) {
|
|
|
22
22
|
if (req.method !== 'POST') {
|
|
23
23
|
throw new Error('Only POST requests are supported.');
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const endpointId = req.query.endpointId.join('/');
|
|
26
26
|
const { blockId, payload, pageId } = req.body;
|
|
27
27
|
context.logger.info({ event: 'call_api_endpoint', blockId, endpointId, pageId });
|
|
28
28
|
const response = await callEndpoint(context, { blockId, endpointId, pageId, payload });
|
|
@@ -20,7 +20,7 @@ import apiWrapper from '../../../lib/server/apiWrapper.js';
|
|
|
20
20
|
import buildPageIfNeeded from '../../../lib/server/jitPageBuilder.js';
|
|
21
21
|
|
|
22
22
|
async function handler({ context, req, res }) {
|
|
23
|
-
const
|
|
23
|
+
const pageId = req.query.pageId.join('/');
|
|
24
24
|
|
|
25
25
|
// Attempt JIT build if page not yet compiled
|
|
26
26
|
let buildResult;
|
|
@@ -16,13 +16,19 @@
|
|
|
16
16
|
|
|
17
17
|
import { callRequest } from '@lowdefy/api';
|
|
18
18
|
|
|
19
|
-
import apiWrapper from '
|
|
19
|
+
import apiWrapper from '../../../lib/server/apiWrapper.js';
|
|
20
20
|
|
|
21
21
|
async function handler({ context, req, res }) {
|
|
22
22
|
if (req.method !== 'POST') {
|
|
23
23
|
throw new Error('Only POST requests are supported.');
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const segments = req.query.path;
|
|
26
|
+
if (!Array.isArray(segments) || segments.length < 2) {
|
|
27
|
+
res.status(400).json({ error: 'Invalid request path' });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const requestId = segments[segments.length - 1];
|
|
31
|
+
const pageId = segments.slice(0, -1).join('/');
|
|
26
32
|
const { actionId, blockId, payload } = req.body;
|
|
27
33
|
context.logger.info(
|
|
28
34
|
{ color: 'gray' },
|
package/pages/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import App from '../lib/client/App.js';
|
|
18
|
-
|
|
19
|
-
export default App;
|
|
File without changes
|