@nocobase/client-v2 2.1.0-alpha.10 → 2.1.0-alpha.11
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/es/utils/globalDeps.d.ts +13 -0
- package/lib/Application.js +2 -0
- package/lib/PluginManager.js +1 -1
- package/lib/utils/globalDeps.d.ts +13 -0
- package/lib/utils/globalDeps.js +82 -0
- package/lib/utils/remotePlugins.js +2 -2
- package/package.json +5 -5
- package/src/Application.tsx +2 -0
- package/src/PluginManager.ts +1 -1
- package/src/__tests__/globalDeps.test.ts +26 -0
- package/src/__tests__/plugin.test.ts +61 -0
- package/src/__tests__/remotePlugins.test.ts +72 -0
- package/src/utils/globalDeps.ts +61 -0
- package/src/utils/remotePlugins.ts +2 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { RequireJS } from './requirejs';
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function defineGlobalDeps(requirejs: RequireJS): void;
|
package/lib/Application.js
CHANGED
|
@@ -62,6 +62,7 @@ var import_RouterManager = require("./RouterManager");
|
|
|
62
62
|
var import_WebSocketClient = require("./WebSocketClient");
|
|
63
63
|
var import_components = require("./components");
|
|
64
64
|
var import_utils = require("./utils");
|
|
65
|
+
var import_globalDeps = require("./utils/globalDeps");
|
|
65
66
|
var import_requirejs = require("./utils/requirejs");
|
|
66
67
|
var _providers, _router;
|
|
67
68
|
const _Application = class _Application {
|
|
@@ -218,6 +219,7 @@ const _Application = class _Application {
|
|
|
218
219
|
return;
|
|
219
220
|
}
|
|
220
221
|
window["requirejs"] = this.requirejs = (0, import_requirejs.getRequireJs)();
|
|
222
|
+
(0, import_globalDeps.defineGlobalDeps)(this.requirejs);
|
|
221
223
|
window.define = this.requirejs.define;
|
|
222
224
|
}
|
|
223
225
|
addDefaultProviders() {
|
package/lib/PluginManager.js
CHANGED
|
@@ -60,7 +60,7 @@ const _PluginManager = class _PluginManager {
|
|
|
60
60
|
}
|
|
61
61
|
async initRemotePlugins() {
|
|
62
62
|
var _a;
|
|
63
|
-
const res = await this.app.apiClient.request({ url: "pm:
|
|
63
|
+
const res = await this.app.apiClient.request({ url: "pm:listEnabledV2" });
|
|
64
64
|
const pluginList = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || [];
|
|
65
65
|
const plugins = await (0, import_remotePlugins.getPlugins)({
|
|
66
66
|
requirejs: this.app.requirejs,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { RequireJS } from './requirejs';
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function defineGlobalDeps(requirejs: RequireJS): void;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
|
+
var __export = (target, all) => {
|
|
18
|
+
for (var name in all)
|
|
19
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(from))
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var globalDeps_exports = {};
|
|
39
|
+
__export(globalDeps_exports, {
|
|
40
|
+
defineGlobalDeps: () => defineGlobalDeps
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(globalDeps_exports);
|
|
43
|
+
var antdCssinjs = __toESM(require("@ant-design/cssinjs"));
|
|
44
|
+
var antdIcons = __toESM(require("@ant-design/icons"));
|
|
45
|
+
var formilyCore = __toESM(require("@formily/core"));
|
|
46
|
+
var formilyReact = __toESM(require("@formily/react"));
|
|
47
|
+
var formilyReactive = __toESM(require("@formily/reactive"));
|
|
48
|
+
var formilyShared = __toESM(require("@formily/shared"));
|
|
49
|
+
var nocobaseFlowEngine = __toESM(require("@nocobase/flow-engine"));
|
|
50
|
+
var antd = __toESM(require("antd"));
|
|
51
|
+
var i18next = __toESM(require("i18next"));
|
|
52
|
+
var import_react = __toESM(require("react"));
|
|
53
|
+
var import_react_dom = __toESM(require("react-dom"));
|
|
54
|
+
var reactI18next = __toESM(require("react-i18next"));
|
|
55
|
+
var ReactRouter = __toESM(require("react-router"));
|
|
56
|
+
var ReactRouterDom = __toESM(require("react-router-dom"));
|
|
57
|
+
var import_jsx_runtime = __toESM(require("react/jsx-runtime"));
|
|
58
|
+
var nocobaseClientV2 = __toESM(require("../index"));
|
|
59
|
+
function defineGlobalDeps(requirejs) {
|
|
60
|
+
requirejs.define("react", () => import_react.default);
|
|
61
|
+
requirejs.define("react-dom", () => import_react_dom.default);
|
|
62
|
+
requirejs.define("react/jsx-runtime", () => import_jsx_runtime.default);
|
|
63
|
+
requirejs.define("react-router", () => ReactRouter);
|
|
64
|
+
requirejs.define("react-router-dom", () => ReactRouterDom);
|
|
65
|
+
requirejs.define("antd", () => antd);
|
|
66
|
+
requirejs.define("@ant-design/icons", () => antdIcons);
|
|
67
|
+
requirejs.define("@ant-design/cssinjs", () => antdCssinjs);
|
|
68
|
+
requirejs.define("i18next", () => i18next);
|
|
69
|
+
requirejs.define("react-i18next", () => reactI18next);
|
|
70
|
+
requirejs.define("@formily/core", () => formilyCore);
|
|
71
|
+
requirejs.define("@formily/react", () => formilyReact);
|
|
72
|
+
requirejs.define("@formily/reactive", () => formilyReactive);
|
|
73
|
+
requirejs.define("@formily/shared", () => formilyShared);
|
|
74
|
+
requirejs.define("@nocobase/client-v2", () => nocobaseClientV2);
|
|
75
|
+
requirejs.define("@nocobase/client-v2/client-v2", () => nocobaseClientV2);
|
|
76
|
+
requirejs.define("@nocobase/flow-engine", () => nocobaseFlowEngine);
|
|
77
|
+
}
|
|
78
|
+
__name(defineGlobalDeps, "defineGlobalDeps");
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
defineGlobalDeps
|
|
82
|
+
});
|
|
@@ -37,12 +37,12 @@ __export(remotePlugins_exports, {
|
|
|
37
37
|
module.exports = __toCommonJS(remotePlugins_exports);
|
|
38
38
|
function defineDevPlugins(plugins) {
|
|
39
39
|
Object.entries(plugins).forEach(([packageName, plugin]) => {
|
|
40
|
-
window.define(`${packageName}/client`, () => plugin);
|
|
40
|
+
window.define(`${packageName}/client-v2`, () => plugin);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
__name(defineDevPlugins, "defineDevPlugins");
|
|
44
44
|
function definePluginClient(packageName) {
|
|
45
|
-
window.define(`${packageName}/client`, ["exports", packageName], function(_exports, _pluginExports) {
|
|
45
|
+
window.define(`${packageName}/client-v2`, ["exports", packageName], function(_exports, _pluginExports) {
|
|
46
46
|
Object.defineProperty(_exports, "__esModule", {
|
|
47
47
|
value: true
|
|
48
48
|
});
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/client-v2",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.11",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.mjs",
|
|
7
7
|
"types": "es/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
10
|
-
"@nocobase/sdk": "2.1.0-alpha.
|
|
11
|
-
"@nocobase/shared": "2.1.0-alpha.
|
|
9
|
+
"@nocobase/flow-engine": "2.1.0-alpha.11",
|
|
10
|
+
"@nocobase/sdk": "2.1.0-alpha.11",
|
|
11
|
+
"@nocobase/shared": "2.1.0-alpha.11",
|
|
12
12
|
"i18next": "^22.4.9",
|
|
13
13
|
"react-router-dom": "^6.30.1"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "bb96d633a6371afb586072ff516bd0613c757db0"
|
|
16
16
|
}
|
package/src/Application.tsx
CHANGED
|
@@ -30,6 +30,7 @@ import { type ComponentTypeAndString, RouterManager, type RouterOptions } from '
|
|
|
30
30
|
import { WebSocketClient, type WebSocketClientOptions } from './WebSocketClient';
|
|
31
31
|
import { BlankComponent } from './components';
|
|
32
32
|
import { compose, normalizeContainer } from './utils';
|
|
33
|
+
import { defineGlobalDeps } from './utils/globalDeps';
|
|
33
34
|
import type { RequireJS } from './utils/requirejs';
|
|
34
35
|
import { getRequireJs } from './utils/requirejs';
|
|
35
36
|
|
|
@@ -232,6 +233,7 @@ export class Application {
|
|
|
232
233
|
return;
|
|
233
234
|
}
|
|
234
235
|
window['requirejs'] = this.requirejs = getRequireJs();
|
|
236
|
+
defineGlobalDeps(this.requirejs);
|
|
235
237
|
window.define = this.requirejs.define;
|
|
236
238
|
}
|
|
237
239
|
|
package/src/PluginManager.ts
CHANGED
|
@@ -54,7 +54,7 @@ export class PluginManager {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
private async initRemotePlugins() {
|
|
57
|
-
const res = await this.app.apiClient.request({ url: 'pm:
|
|
57
|
+
const res = await this.app.apiClient.request({ url: 'pm:listEnabledV2' });
|
|
58
58
|
const pluginList: PluginData[] = res?.data?.data || [];
|
|
59
59
|
const plugins = await getPlugins({
|
|
60
60
|
requirejs: this.app.requirejs,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { defineGlobalDeps } from '../utils/globalDeps';
|
|
11
|
+
|
|
12
|
+
describe('client-v2 defineGlobalDeps', () => {
|
|
13
|
+
it('should register shared AMD dependencies for remote plugins', () => {
|
|
14
|
+
const define = vi.fn();
|
|
15
|
+
|
|
16
|
+
defineGlobalDeps({
|
|
17
|
+
define,
|
|
18
|
+
} as any);
|
|
19
|
+
|
|
20
|
+
expect(define).toHaveBeenCalledWith('react', expect.any(Function));
|
|
21
|
+
expect(define).toHaveBeenCalledWith('react-router-dom', expect.any(Function));
|
|
22
|
+
expect(define).toHaveBeenCalledWith('@formily/react', expect.any(Function));
|
|
23
|
+
expect(define).toHaveBeenCalledWith('@nocobase/client-v2', expect.any(Function));
|
|
24
|
+
expect(define).toHaveBeenCalledWith('@nocobase/flow-engine', expect.any(Function));
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { createMockClient, Plugin } from '@nocobase/client-v2';
|
|
11
|
+
|
|
12
|
+
describe('PluginManager', () => {
|
|
13
|
+
it('should request remote plugins from pm:listEnabledV2', async () => {
|
|
14
|
+
const app = createMockClient({
|
|
15
|
+
loadRemotePlugins: true,
|
|
16
|
+
});
|
|
17
|
+
app.apiMock.onGet('pm:listEnabledV2').reply(200, { data: [] });
|
|
18
|
+
|
|
19
|
+
await app.load();
|
|
20
|
+
|
|
21
|
+
expect(app.apiMock.history.get).toHaveLength(1);
|
|
22
|
+
expect(app.apiMock.history.get[0]?.url).toBe('pm:listEnabledV2');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should not request remote plugins from pm:listEnabled', async () => {
|
|
26
|
+
const app = createMockClient({
|
|
27
|
+
loadRemotePlugins: true,
|
|
28
|
+
});
|
|
29
|
+
app.apiMock.onGet('pm:listEnabledV2').reply(200, { data: [] });
|
|
30
|
+
|
|
31
|
+
await app.load();
|
|
32
|
+
|
|
33
|
+
expect(app.apiMock.history.get.some((request) => request.url === 'pm:listEnabled')).toBe(false);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should define client-v2 module ids for dev plugins', async () => {
|
|
37
|
+
class DemoPlugin extends Plugin {}
|
|
38
|
+
|
|
39
|
+
const mockDefine: any = vi.fn();
|
|
40
|
+
window.define = mockDefine;
|
|
41
|
+
|
|
42
|
+
const app = createMockClient({
|
|
43
|
+
loadRemotePlugins: true,
|
|
44
|
+
devDynamicImport: vi.fn().mockResolvedValue({ default: DemoPlugin }) as any,
|
|
45
|
+
});
|
|
46
|
+
app.apiMock.onGet('pm:listEnabledV2').reply(200, {
|
|
47
|
+
data: [
|
|
48
|
+
{
|
|
49
|
+
name: '@nocobase/demo',
|
|
50
|
+
packageName: '@nocobase/demo',
|
|
51
|
+
url: 'https://demo.com/dist/client-v2/index.js',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
await app.load();
|
|
57
|
+
|
|
58
|
+
expect(mockDefine).toHaveBeenCalledWith('@nocobase/demo/client-v2', expect.any(Function));
|
|
59
|
+
expect(mockDefine).not.toHaveBeenCalledWith('@nocobase/demo/client', expect.any(Function));
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Plugin } from '../Plugin';
|
|
11
|
+
import { defineDevPlugins, definePluginClient, getPlugins } from '../utils/remotePlugins';
|
|
12
|
+
|
|
13
|
+
describe('client-v2 remotePlugins', () => {
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
window.define = undefined;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should define dev plugins with /client-v2 module ids', () => {
|
|
19
|
+
class DemoPlugin extends Plugin {}
|
|
20
|
+
|
|
21
|
+
const mockDefine: any = vi.fn();
|
|
22
|
+
window.define = mockDefine;
|
|
23
|
+
|
|
24
|
+
defineDevPlugins({
|
|
25
|
+
'@nocobase/demo': DemoPlugin,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
expect(mockDefine).toHaveBeenCalledWith('@nocobase/demo/client-v2', expect.any(Function));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should define remote plugin proxies with /client-v2 module ids', () => {
|
|
32
|
+
const mockDefine: any = vi.fn();
|
|
33
|
+
window.define = mockDefine;
|
|
34
|
+
|
|
35
|
+
definePluginClient('@nocobase/demo');
|
|
36
|
+
|
|
37
|
+
expect(mockDefine).toHaveBeenCalledWith(
|
|
38
|
+
'@nocobase/demo/client-v2',
|
|
39
|
+
['exports', '@nocobase/demo'],
|
|
40
|
+
expect.any(Function),
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should not define /client aliases when loading v2 plugins', async () => {
|
|
45
|
+
class DemoPlugin extends Plugin {}
|
|
46
|
+
|
|
47
|
+
const requirejs: any = {
|
|
48
|
+
requirejs: vi.fn(),
|
|
49
|
+
};
|
|
50
|
+
requirejs.requirejs.config = vi.fn();
|
|
51
|
+
requirejs.requirejs.requirejs = vi.fn();
|
|
52
|
+
|
|
53
|
+
const mockDefine: any = vi.fn();
|
|
54
|
+
window.define = mockDefine;
|
|
55
|
+
|
|
56
|
+
const plugins = await getPlugins({
|
|
57
|
+
requirejs,
|
|
58
|
+
pluginData: [
|
|
59
|
+
{
|
|
60
|
+
name: '@nocobase/demo',
|
|
61
|
+
packageName: '@nocobase/demo',
|
|
62
|
+
url: 'https://demo.com/dist/client-v2/index.js',
|
|
63
|
+
},
|
|
64
|
+
] as any,
|
|
65
|
+
devDynamicImport: vi.fn().mockResolvedValue({ default: DemoPlugin }) as any,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
expect(plugins).toEqual([['@nocobase/demo', DemoPlugin]]);
|
|
69
|
+
expect(mockDefine).toHaveBeenCalledWith('@nocobase/demo/client-v2', expect.any(Function));
|
|
70
|
+
expect(mockDefine).not.toHaveBeenCalledWith('@nocobase/demo/client', expect.any(Function));
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import * as antdCssinjs from '@ant-design/cssinjs';
|
|
11
|
+
import * as antdIcons from '@ant-design/icons';
|
|
12
|
+
import * as formilyCore from '@formily/core';
|
|
13
|
+
import * as formilyReact from '@formily/react';
|
|
14
|
+
import * as formilyReactive from '@formily/reactive';
|
|
15
|
+
import * as formilyShared from '@formily/shared';
|
|
16
|
+
import * as nocobaseFlowEngine from '@nocobase/flow-engine';
|
|
17
|
+
import * as antd from 'antd';
|
|
18
|
+
import * as i18next from 'i18next';
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import ReactDOM from 'react-dom';
|
|
21
|
+
import * as reactI18next from 'react-i18next';
|
|
22
|
+
import * as ReactRouter from 'react-router';
|
|
23
|
+
import * as ReactRouterDom from 'react-router-dom';
|
|
24
|
+
import jsxRuntime from 'react/jsx-runtime';
|
|
25
|
+
import * as nocobaseClientV2 from '../index';
|
|
26
|
+
|
|
27
|
+
import type { RequireJS } from './requirejs';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export function defineGlobalDeps(requirejs: RequireJS) {
|
|
33
|
+
// react
|
|
34
|
+
requirejs.define('react', () => React);
|
|
35
|
+
requirejs.define('react-dom', () => ReactDOM);
|
|
36
|
+
requirejs.define('react/jsx-runtime', () => jsxRuntime);
|
|
37
|
+
|
|
38
|
+
// react-router
|
|
39
|
+
requirejs.define('react-router', () => ReactRouter);
|
|
40
|
+
requirejs.define('react-router-dom', () => ReactRouterDom);
|
|
41
|
+
|
|
42
|
+
// antd
|
|
43
|
+
requirejs.define('antd', () => antd);
|
|
44
|
+
requirejs.define('@ant-design/icons', () => antdIcons);
|
|
45
|
+
requirejs.define('@ant-design/cssinjs', () => antdCssinjs);
|
|
46
|
+
|
|
47
|
+
// i18next
|
|
48
|
+
requirejs.define('i18next', () => i18next);
|
|
49
|
+
requirejs.define('react-i18next', () => reactI18next);
|
|
50
|
+
|
|
51
|
+
// formily
|
|
52
|
+
requirejs.define('@formily/core', () => formilyCore);
|
|
53
|
+
requirejs.define('@formily/react', () => formilyReact);
|
|
54
|
+
requirejs.define('@formily/reactive', () => formilyReactive);
|
|
55
|
+
requirejs.define('@formily/shared', () => formilyShared);
|
|
56
|
+
|
|
57
|
+
// nocobase
|
|
58
|
+
requirejs.define('@nocobase/client-v2', () => nocobaseClientV2);
|
|
59
|
+
requirejs.define('@nocobase/client-v2/client-v2', () => nocobaseClientV2);
|
|
60
|
+
requirejs.define('@nocobase/flow-engine', () => nocobaseFlowEngine);
|
|
61
|
+
}
|
|
@@ -17,7 +17,7 @@ import type { RequireJS } from './requirejs';
|
|
|
17
17
|
*/
|
|
18
18
|
export function defineDevPlugins(plugins: Record<string, typeof Plugin>) {
|
|
19
19
|
Object.entries(plugins).forEach(([packageName, plugin]) => {
|
|
20
|
-
window.define(`${packageName}/client`, () => plugin);
|
|
20
|
+
window.define(`${packageName}/client-v2`, () => plugin);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ export function defineDevPlugins(plugins: Record<string, typeof Plugin>) {
|
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
27
|
export function definePluginClient(packageName: string) {
|
|
28
|
-
window.define(`${packageName}/client`, ['exports', packageName], function (_exports: any, _pluginExports: any) {
|
|
28
|
+
window.define(`${packageName}/client-v2`, ['exports', packageName], function (_exports: any, _pluginExports: any) {
|
|
29
29
|
Object.defineProperty(_exports, '__esModule', {
|
|
30
30
|
value: true,
|
|
31
31
|
});
|