GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: componentName can contain dot notation · skymysky/lowcode-engine@3a0ab6d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • modules/code-generator/src
    • plugins/common
      • esmodule.ts
    • utils
      • validate.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎modules/code-generator/src/plugins/common/esmodule.ts‎

Copy file name to clipboardExpand all lines: modules/code-generator/src/plugins/common/esmodule.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
IWithDependency,
1717
} from '../../types';
1818

19-
import { isValidIdentifier } from '../../utils/validate';
19+
import { isValidIdentifier, isValidComponentName } from '../../utils/validate';
2020

2121
// TODO: main 这个信息到底怎么用,是不是外部包不需要使用?
2222
const DEP_MAIN_BLOCKLIST = ['lib', 'lib/index', 'es', 'es/index', 'main'];
@@ -261,7 +261,7 @@ function buildPackageImport(
261261
if (!isValidIdentifier(name)) {
262262
throw new CodeGeneratorError(`Invalid Identifier [${name}]`);
263263
}
264-
if (info.nodeIdentifier && !isValidIdentifier(info.nodeIdentifier)) {
264+
if (info.nodeIdentifier && !isValidComponentName(info.nodeIdentifier)) {
265265
throw new CodeGeneratorError(`Invalid Identifier [${info.nodeIdentifier}]`);
266266
}
267267
});
Collapse file

‎modules/code-generator/src/utils/validate.ts‎

Copy file name to clipboardExpand all lines: modules/code-generator/src/utils/validate.ts
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ export const isValidIdentifier = (name: string) => {
22
return /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(name);
33
};
44

5+
export const isValidComponentName = (name: string) => {
6+
return /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF.]*$/.test(name);
7+
};
8+
59
export const ensureValidClassName = (name: string) => {
610
if (!isValidIdentifier(name)) {
711
return `$${name.replace(/[^_$a-zA-Z0-9]/g, '')}`;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.