feat: integrate json-template-parser package and update imports across core modules

This commit is contained in:
sheldon guo 2025-02-26 23:07:28 +08:00
parent afc76bc775
commit e8939b0fab
8 changed files with 13 additions and 7 deletions

View File

@ -30,6 +30,7 @@
"@nocobase/evaluators": "1.6.0-alpha.28",
"@nocobase/sdk": "1.6.0-alpha.28",
"@nocobase/utils": "1.6.0-alpha.28",
"@nocobase/json-template-parser": "1.6.0-alpha.28",
"ahooks": "^3.7.2",
"antd": "5.12.8",
"antd-style": "3.7.1",

View File

@ -17,7 +17,7 @@ import React, { ComponentType, FC, ReactElement, ReactNode } from 'react';
import { createRoot } from 'react-dom/client';
import { I18nextProvider } from 'react-i18next';
import { Link, NavLink, Navigate } from 'react-router-dom';
import { createJSONTemplateParser, JSONTemplateParser } from '@nocobase/json-template-parser';
import { APIClient, APIClientProvider } from '../api-client';
import { CSSVariableProvider } from '../css-variable';
import { AntdAppProvider, GlobalThemeProvider } from '../global-theme';
@ -83,6 +83,7 @@ export interface ApplicationOptions {
export class Application {
public eventBus = new EventTarget();
public jsonTemplateParser: JSONTemplateParser;
public providers: ComponentAndProps[] = [];
public router: RouterManager;
@ -162,6 +163,7 @@ export class Application {
});
this.initListeners();
this.jsonLogic = getOperators();
this.jsonTemplateParser = createJSONTemplateParser();
}
private initListeners() {

View File

@ -1,5 +1,5 @@
{
"name": "@nocobase/json-templates",
"name": "@nocobase/json-template-parser",
"version": "1.6.0-alpha.28",
"license": "AGPL-3.0",
"main": "lib/index.js",

View File

@ -8,4 +8,4 @@
*/
export { parse } from './parse';
export { createJSONTemplateParser } from './json-template-parser';
export { createJSONTemplateParser, JSONTemplateParser } from './json-template-parser';

View File

@ -23,7 +23,7 @@ type Filter = {
uiSchema: any;
};
class JSONTemplateParser {
export class JSONTemplateParser {
engine: Liquid;
private _filterGroups: Array<FilterGroup>;
private _filters: Array<Filter>;

View File

@ -17,6 +17,7 @@
"@nocobase/data-source-manager": "1.6.0-alpha.28",
"@nocobase/database": "1.6.0-alpha.28",
"@nocobase/evaluators": "1.6.0-alpha.28",
"@nocobase/json-template-parser": "1.6.0-alpha.28",
"@nocobase/lock-manager": "1.6.0-alpha.28",
"@nocobase/logger": "1.6.0-alpha.28",
"@nocobase/resourcer": "1.6.0-alpha.28",

View File

@ -34,7 +34,7 @@ import {
ToposortOptions,
wrapMiddlewareWithLogging,
} from '@nocobase/utils';
import { createJSONTemplateParser, JSONTemplateParser } from '@nocobase/json-template-parser';
import { Command, CommandOptions, ParseOptions } from 'commander';
import { randomUUID } from 'crypto';
import glob from 'glob';
@ -250,7 +250,7 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
public container = new ServiceContainer();
public lockManager: LockManager;
public jsonTemplateParser: JSONTemplateParser;
constructor(public options: ApplicationOptions) {
super();
this.context.reqId = randomUUID();
@ -260,6 +260,8 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
if (!options.skipSupervisor) {
this._appSupervisor.addApp(this);
}
this.jsonTemplateParser = createJSONTemplateParser();
}
private static staticCommands = [];

View File

@ -6,7 +6,7 @@
"license": "AGPL-3.0",
"dependencies": {
"@budibase/handlebars-helpers": "^0.14.0",
"@nocobase/json-templates": "1.6.0-alpha.28",
"@nocobase/json-template-parser": "1.6.0-alpha.28",
"@hapi/topo": "^6.0.0",
"@rc-component/mini-decimal": "^1.1.0",
"dayjs": "^1.11.9",