@lowdefy/server 4.7.3 → 5.0.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.
@@ -22,6 +22,7 @@ import Head from 'next/head';
22
22
  import Link from 'next/link';
23
23
 
24
24
  import actions from '../../build/plugins/actions.js';
25
+ import blockMetas from '../../build/plugins/blockMetas.json';
25
26
  import blocks from '../../build/plugins/blocks.js';
26
27
  import icons from '../../build/plugins/icons.js';
27
28
  import operators from '../../build/plugins/operators/client.js';
@@ -42,6 +43,7 @@ const Page = ({ auth, lowdefy, pageConfig, rootConfig }) => {
42
43
  router={router}
43
44
  types={{
44
45
  actions,
46
+ blockMetas,
45
47
  blocks,
46
48
  icons,
47
49
  operators,
@@ -15,12 +15,15 @@
15
15
  limitations under the License.
16
16
  */
17
17
 
18
+ import { createRequire } from 'node:module';
18
19
  import path from 'path';
19
20
  import { get } from '@lowdefy/helpers';
20
21
  import { readFile } from '@lowdefy/node-utils';
21
22
  import { createPluginTypesMap } from '@lowdefy/build';
22
23
  import YAML from 'yaml';
23
24
 
25
+ const require = createRequire(import.meta.url);
26
+
24
27
  async function getPluginDefinitions({ directories }) {
25
28
  let lowdefyYaml = await readFile(path.join(directories.config, 'lowdefy.yaml'));
26
29
  if (!lowdefyYaml) {
@@ -42,6 +45,7 @@ async function createCustomPluginTypesMap({ directories }) {
42
45
  events: {},
43
46
  providers: {},
44
47
  },
48
+ blockMetas: {},
45
49
  blocks: {},
46
50
  connections: {},
47
51
  icons: {},
@@ -50,18 +54,14 @@ async function createCustomPluginTypesMap({ directories }) {
50
54
  server: {},
51
55
  },
52
56
  requests: {},
53
- styles: {
54
- packages: {},
55
- blocks: {},
56
- },
57
57
  };
58
58
 
59
59
  const pluginDefinitions = await getPluginDefinitions({ directories });
60
60
 
61
61
  for (const plugin of pluginDefinitions) {
62
- const { default: types } = await import(`${plugin.name}/types`);
62
+ const types = require(`${plugin.name}/types`);
63
63
  createPluginTypesMap({
64
- packageTypes: types,
64
+ packageTypes: types.default ?? types,
65
65
  typesMap: customTypesMap,
66
66
  packageName: plugin.name,
67
67
  version: plugin.version,
package/next.config.js CHANGED
@@ -1,33 +1,16 @@
1
1
  const { withSentryConfig } = require('@sentry/nextjs');
2
- const withLess = require('next-with-less');
3
2
  const lowdefyConfig = require('./build/config.json');
3
+ const blockPackages = require('./build/blockPackages.json');
4
4
 
5
- const nextConfig = withLess({
5
+ const nextConfig = {
6
6
  basePath: lowdefyConfig.basePath,
7
7
  reactStrictMode: true,
8
- webpack: (config, { isServer }) => {
9
- if (!isServer) {
10
- config.resolve.fallback = {
11
- assert: false,
12
- buffer: false,
13
- crypto: false,
14
- events: false,
15
- fs: false,
16
- path: false,
17
- process: require.resolve('process/browser'),
18
- util: false,
19
- };
20
- }
21
- return config;
22
- },
8
+ transpilePackages: ['@lowdefy/client', ...blockPackages],
9
+ turbopack: {},
23
10
  poweredByHeader: false,
24
11
  // productionBrowserSourceMaps: true
25
12
  output: process.env.LOWDEFY_BUILD_OUTPUT_STANDALONE === '1' ? 'standalone' : undefined,
26
- outputFileTracing: true,
27
- eslint: {
28
- ignoreDuringBuilds: true,
29
- },
30
- });
13
+ };
31
14
 
32
15
  // Only wrap with Sentry if SENTRY_DSN is configured
33
16
  // This enables source map uploads when SENTRY_AUTH_TOKEN is present
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server",
3
- "version": "4.7.3",
3
+ "version": "5.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -31,46 +31,45 @@
31
31
  "pages/*",
32
32
  "public_default/*",
33
33
  "next.config.js",
34
+ "postcss.config.js",
34
35
  "package.original.json",
35
36
  ".eslintrc.yaml",
36
37
  ".npmrc"
37
38
  ],
38
39
  "dependencies": {
39
- "@lowdefy/actions-core": "4.7.3",
40
- "@lowdefy/api": "4.7.3",
41
- "@lowdefy/block-utils": "4.7.3",
42
- "@lowdefy/blocks-antd": "4.7.3",
43
- "@lowdefy/blocks-basic": "4.7.3",
44
- "@lowdefy/blocks-loaders": "4.7.3",
45
- "@lowdefy/blocks-markdown": "4.7.3",
46
- "@lowdefy/client": "4.7.3",
47
- "@lowdefy/connection-axios-http": "4.7.3",
48
- "@lowdefy/connection-mongodb": "4.7.3",
49
- "@lowdefy/errors": "4.7.3",
50
- "@lowdefy/helpers": "4.7.3",
51
- "@lowdefy/layout": "4.7.3",
52
- "@lowdefy/logger": "4.7.3",
53
- "@lowdefy/node-utils": "4.7.3",
54
- "@lowdefy/operators-js": "4.7.3",
55
- "@lowdefy/operators-nunjucks": "4.7.3",
56
- "@lowdefy/operators-uuid": "4.7.3",
57
- "@lowdefy/plugin-next-auth": "4.7.3",
40
+ "@ant-design/cssinjs": "2.1.2",
41
+ "@lowdefy/actions-core": "5.0.0",
42
+ "@lowdefy/api": "5.0.0",
43
+ "@lowdefy/block-utils": "5.0.0",
44
+ "@lowdefy/blocks-antd": "5.0.0",
45
+ "@lowdefy/blocks-basic": "5.0.0",
46
+ "@lowdefy/blocks-loaders": "5.0.0",
47
+ "@lowdefy/client": "5.0.0",
48
+ "@lowdefy/errors": "5.0.0",
49
+ "@lowdefy/helpers": "5.0.0",
50
+ "@lowdefy/layout": "5.0.0",
51
+ "@lowdefy/logger": "5.0.0",
52
+ "@lowdefy/node-utils": "5.0.0",
53
+ "@lowdefy/operators-js": "5.0.0",
54
+ "@lowdefy/plugin-next-auth": "5.0.0",
58
55
  "@sentry/nextjs": "8.53.0",
59
- "next": "13.5.4",
60
- "next-auth": "4.24.5",
56
+ "@tailwindcss/postcss": "4.2.1",
57
+ "tailwindcss": "4.2.1",
58
+ "antd": "6.3.1",
59
+ "dayjs": "1.11.19",
60
+ "next": "16.1.6",
61
+ "next-auth": "4.24.10",
61
62
  "pino": "8.16.2",
62
- "process": "0.11.10",
63
63
  "react": "18.2.0",
64
64
  "react-dom": "18.2.0",
65
- "react-icons": "4.12.0",
65
+ "react-icons": "5.6.0",
66
66
  "uuid": "13.0.0"
67
67
  },
68
68
  "devDependencies": {
69
- "@lowdefy/build": "4.7.3",
70
- "@next/eslint-plugin-next": "13.5.4",
71
- "less": "4.2.0",
72
- "less-loader": "11.1.3",
73
- "next-with-less": "3.0.1",
69
+ "@lowdefy/build": "5.0.0",
70
+ "@next/eslint-plugin-next": "16.1.6",
71
+ "@tailwindcss/postcss": "4.2.1",
72
+ "tailwindcss": "4.2.1",
74
73
  "webpack": "5.94.0",
75
74
  "yaml": "2.3.4",
76
75
  "yargs": "17.7.2"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server",
3
- "version": "4.7.3",
3
+ "version": "5.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -31,6 +31,7 @@
31
31
  "pages/*",
32
32
  "public_default/*",
33
33
  "next.config.js",
34
+ "postcss.config.js",
34
35
  "package.original.json",
35
36
  ".eslintrc.yaml",
36
37
  ".npmrc"
@@ -46,41 +47,39 @@
46
47
  "prepublishOnly": "pnpm build"
47
48
  },
48
49
  "dependencies": {
49
- "@lowdefy/actions-core": "4.7.3",
50
- "@lowdefy/api": "4.7.3",
51
- "@lowdefy/block-utils": "4.7.3",
52
- "@lowdefy/blocks-antd": "4.7.3",
53
- "@lowdefy/blocks-basic": "4.7.3",
54
- "@lowdefy/blocks-loaders": "4.7.3",
55
- "@lowdefy/blocks-markdown": "4.7.3",
56
- "@lowdefy/client": "4.7.3",
57
- "@lowdefy/connection-axios-http": "4.7.3",
58
- "@lowdefy/connection-mongodb": "4.7.3",
59
- "@lowdefy/errors": "4.7.3",
60
- "@lowdefy/helpers": "4.7.3",
61
- "@lowdefy/layout": "4.7.3",
62
- "@lowdefy/logger": "4.7.3",
63
- "@lowdefy/node-utils": "4.7.3",
64
- "@lowdefy/operators-js": "4.7.3",
65
- "@lowdefy/operators-nunjucks": "4.7.3",
66
- "@lowdefy/operators-uuid": "4.7.3",
67
- "@lowdefy/plugin-next-auth": "4.7.3",
50
+ "@ant-design/cssinjs": "2.1.2",
51
+ "@lowdefy/actions-core": "5.0.0",
52
+ "@lowdefy/api": "5.0.0",
53
+ "@lowdefy/block-utils": "5.0.0",
54
+ "@lowdefy/blocks-antd": "5.0.0",
55
+ "@lowdefy/blocks-basic": "5.0.0",
56
+ "@lowdefy/blocks-loaders": "5.0.0",
57
+ "@lowdefy/client": "5.0.0",
58
+ "@lowdefy/errors": "5.0.0",
59
+ "@lowdefy/helpers": "5.0.0",
60
+ "@lowdefy/layout": "5.0.0",
61
+ "@lowdefy/logger": "5.0.0",
62
+ "@lowdefy/node-utils": "5.0.0",
63
+ "@lowdefy/operators-js": "5.0.0",
64
+ "@lowdefy/plugin-next-auth": "5.0.0",
68
65
  "@sentry/nextjs": "8.53.0",
69
- "next": "13.5.4",
70
- "next-auth": "4.24.5",
66
+ "@tailwindcss/postcss": "4.2.1",
67
+ "tailwindcss": "4.2.1",
68
+ "antd": "6.3.1",
69
+ "dayjs": "1.11.19",
70
+ "next": "16.1.6",
71
+ "next-auth": "4.24.10",
71
72
  "pino": "8.16.2",
72
- "process": "0.11.10",
73
73
  "react": "18.2.0",
74
74
  "react-dom": "18.2.0",
75
- "react-icons": "4.12.0",
75
+ "react-icons": "5.6.0",
76
76
  "uuid": "13.0.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@lowdefy/build": "4.7.3",
80
- "@next/eslint-plugin-next": "13.5.4",
81
- "less": "4.2.0",
82
- "less-loader": "11.1.3",
83
- "next-with-less": "3.0.1",
79
+ "@lowdefy/build": "5.0.0",
80
+ "@next/eslint-plugin-next": "16.1.6",
81
+ "@tailwindcss/postcss": "4.2.1",
82
+ "tailwindcss": "4.2.1",
84
83
  "webpack": "5.94.0",
85
84
  "yaml": "2.3.4",
86
85
  "yargs": "17.7.2"
package/pages/_app.js CHANGED
@@ -14,10 +14,18 @@
14
14
  limitations under the License.
15
15
  */
16
16
 
17
+ // CSS layer order — MUST be the first CSS import. Next.js treats this as critical
18
+ // CSS that loads before hydration, locking the cascade priority (antd > base/preflight)
19
+ // before antd's StyleProvider injects @layer antd {} at runtime.
20
+ import '../build/layer-order.css';
21
+
17
22
  import React, { useCallback, useRef } from 'react';
18
23
  import dynamic from 'next/dynamic';
19
24
 
20
25
  import { ErrorBoundary } from '@lowdefy/block-utils';
26
+ import { useDarkMode } from '@lowdefy/client';
27
+ import { StyleProvider } from '@ant-design/cssinjs';
28
+ import { App as AntdApp, ConfigProvider, theme as antdTheme } from 'antd';
21
29
 
22
30
  import Auth from '../lib/client/auth/Auth.js';
23
31
  import createLogUsage from '../lib/client/createLogUsage.js';
@@ -26,7 +34,7 @@ import loggerConfig from '../lib/build/logger.js';
26
34
  import setSentryUser from '../lib/client/sentry/setSentryUser.js';
27
35
 
28
36
  // Must be in _app due to next specifications.
29
- import '../build/plugins/styles.less';
37
+ import '../build/globals.css';
30
38
 
31
39
  // Initialize Sentry client once on module load
32
40
  initSentryClient({
@@ -34,9 +42,26 @@ initSentryClient({
34
42
  sentryConfig: loggerConfig.sentry,
35
43
  });
36
44
 
45
+ function ThemeTokenResolver({ lowdefyRef, children }) {
46
+ const { token } = antdTheme.useToken();
47
+ if (!lowdefyRef.current.theme) {
48
+ lowdefyRef.current.theme = {};
49
+ }
50
+ lowdefyRef.current.theme._resolvedAntdToken = token;
51
+ return children;
52
+ }
53
+
37
54
  function App({ Component, pageProps: { session, rootConfig, pageConfig } }) {
38
55
  const usageDataRef = useRef({});
39
56
  const lowdefyRef = useRef({ eventCallback: createLogUsage({ usageDataRef }) });
57
+ if (rootConfig?.theme) {
58
+ lowdefyRef.current.theme = rootConfig.theme;
59
+ }
60
+
61
+ const algorithm = useDarkMode({
62
+ baseAlgorithm: lowdefyRef.current.theme?.antd?.algorithm,
63
+ configDarkMode: lowdefyRef.current.theme?.darkMode,
64
+ });
40
65
 
41
66
  const handleError = useCallback((error) => {
42
67
  if (lowdefyRef.current?._internal?.handleError) {
@@ -47,26 +72,41 @@ function App({ Component, pageProps: { session, rootConfig, pageConfig } }) {
47
72
  }, []);
48
73
 
49
74
  return (
50
- <ErrorBoundary fullPage onError={handleError}>
51
- <Auth session={session}>
52
- {(auth) => {
53
- usageDataRef.current.user = auth.session?.hashed_id;
54
- // Set Sentry user context when auth changes
55
- setSentryUser({
56
- user: auth.session,
57
- sentryConfig: loggerConfig.sentry,
58
- });
59
- return (
60
- <Component
61
- auth={auth}
62
- lowdefy={lowdefyRef.current}
63
- rootConfig={rootConfig}
64
- pageConfig={pageConfig}
65
- />
66
- );
75
+ <StyleProvider layer>
76
+ <ConfigProvider
77
+ theme={{
78
+ ...lowdefyRef.current.theme?.antd,
79
+ cssVar: { key: 'lowdefy' },
80
+ hashed: false,
81
+ algorithm,
67
82
  }}
68
- </Auth>
69
- </ErrorBoundary>
83
+ >
84
+ <AntdApp>
85
+ <ThemeTokenResolver lowdefyRef={lowdefyRef}>
86
+ <ErrorBoundary fullPage onError={handleError}>
87
+ <Auth session={session}>
88
+ {(auth) => {
89
+ usageDataRef.current.user = auth.session?.hashed_id;
90
+ // Set Sentry user context when auth changes
91
+ setSentryUser({
92
+ user: auth.session,
93
+ sentryConfig: loggerConfig.sentry,
94
+ });
95
+ return (
96
+ <Component
97
+ auth={auth}
98
+ lowdefy={lowdefyRef.current}
99
+ rootConfig={rootConfig}
100
+ pageConfig={pageConfig}
101
+ />
102
+ );
103
+ }}
104
+ </Auth>
105
+ </ErrorBoundary>
106
+ </ThemeTokenResolver>
107
+ </AntdApp>
108
+ </ConfigProvider>
109
+ </StyleProvider>
70
110
  );
71
111
  }
72
112
 
@@ -25,8 +25,19 @@ const basePath = lowdefyConfig.basePath ?? '';
25
25
  class LowdefyDocument extends Document {
26
26
  render() {
27
27
  return (
28
- <Html>
28
+ <Html className="lowdefy">
29
29
  <Head>
30
+ {/* Synchronous script that creates the @layer order declaration and keeps
31
+ it as the first child of <head> via MutationObserver. antd's CSS-in-JS
32
+ uses prependQueue to inject <style> tags at the top of <head>, which
33
+ would otherwise make @layer antd the first (lowest priority) layer.
34
+ MutationObserver fires before paint, so the browser never sees the
35
+ wrong cascade order. */}
36
+ <script
37
+ dangerouslySetInnerHTML={{
38
+ __html: `(function(){var s=document.createElement("style");s.id="__lf-layer-order";s.textContent="@layer theme, base, antd, components, utilities;";document.head.prepend(s);new MutationObserver(function(){if(document.head.firstChild!==s)document.head.prepend(s)}).observe(document.head,{childList:true})})();`,
39
+ }}
40
+ />
30
41
  <link rel="manifest" href={`${basePath}/manifest.webmanifest`} />
31
42
  <link rel="icon" type="image/svg+xml" href={`${basePath}/icon.svg`} />
32
43
  <link rel="apple-touch-icon" href={`${basePath}/apple-touch-icon.png`} />
@@ -0,0 +1 @@
1
+ module.exports = { plugins: { '@tailwindcss/postcss': {} } };