From 3dd4be3c4eaa437ca982e98b43f9b77567385e03 Mon Sep 17 00:00:00 2001 From: terlinhe Date: Sun, 6 Jul 2025 03:52:06 +0800 Subject: [PATCH 01/14] feat: version 1.1.11 # Reviewed, transaction id: 49060 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac323315f..7186f424f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lesscode", - "version": "1.1.10", + "version": "1.1.11", "description": "", "main": "index.js", "scripts": { From d627a0e931b2a0b32062e140c8ba5efe6d7a9f71 Mon Sep 17 00:00:00 2001 From: terlinhe Date: Sun, 6 Jul 2025 17:21:36 +0800 Subject: [PATCH 02/14] =?UTF-8?q?fix:=20=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20#=20Reviewed,=20transaction=20id:=2049061?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/client/src/common/tnpm-version-valid.js | 180 ------------------ .../all/components/operation.vue | 7 +- lib/server/controller/component.js | 6 +- lib/server/controller/project-code.js | 4 +- lib/server/controller/user.js | 1 - lib/server/decorator/send/index.js | 8 +- lib/server/initResources/custom-comp/index.js | 9 +- lib/server/model/project-code.js | 5 + .../lib/server/controller/user.js | 3 +- .../lib/server/controller/custom-business.js | 10 +- .../lib/server/controller/user.js | 3 +- lib/server/service/business/v3-service.js | 9 +- lib/server/service/common/user-info.js | 6 +- lib/server/utils/npm/index.js | 4 +- 14 files changed, 45 insertions(+), 210 deletions(-) delete mode 100644 lib/client/src/common/tnpm-version-valid.js diff --git a/lib/client/src/common/tnpm-version-valid.js b/lib/client/src/common/tnpm-version-valid.js deleted file mode 100644 index 2c2a4e3f1..000000000 --- a/lib/client/src/common/tnpm-version-valid.js +++ /dev/null @@ -1,180 +0,0 @@ -const MAX_SAFE_COMPONENT_LENGTH = 16 -exports = module.exports = {} - -// The actual regexps go on exports.re -const re = exports.re = [] -const src = exports.src = [] -const t = exports.t = {} -let R = 0 - -const createToken = (name, value, isGlobal) => { - const index = R++ - t[name] = index - src[index] = value - re[index] = new RegExp(value, isGlobal ? 'g' : undefined) -} - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') -createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') - -// ## Main Version -// Three dot-separated numeric identifiers. - -createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` - + `(${src[t.NUMERICIDENTIFIER]})\\.` - + `(${src[t.NUMERICIDENTIFIER]})`) - -createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` - + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` - + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] -}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) - -createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] -}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] -}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -createToken('FULLPLAIN', `v?${src[t.MAINVERSION] -}${src[t.PRERELEASE]}?${ - src[t.BUILD]}?`) - -createToken('FULL', `^${src[t.FULLPLAIN]}$`) - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] -}${src[t.PRERELEASELOOSE]}?${ - src[t.BUILD]}?`) - -createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) - -createToken('GTLT', '((?:<|>)?=?)') - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) -createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) - -createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` - + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` - + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` - + `(?:${src[t.PRERELEASE]})?${ - src[t.BUILD]}?` - + ')?)?') - -createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` - + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` - + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` - + `(?:${src[t.PRERELEASELOOSE]})?${ - src[t.BUILD]}?` - + ')?)?') - -createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) -createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -createToken('COERCE', `${'(^|[^\\d])' - + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` - + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` - + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` - + '(?:$|[^\\d])') -createToken('COERCERTL', src[t.COERCE], true) - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -createToken('LONETILDE', '(?:~>?)') - -createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) -exports.tildeTrimReplace = '$1~' - -createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) -createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -createToken('LONECARET', '(?:\\^)') - -createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) -exports.caretTrimReplace = '$1^' - -createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) -createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) -createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] -}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) -exports.comparatorTrimReplace = '$1$2$3' - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` - + '\\s+-\\s+' - + `(${src[t.XRANGEPLAIN]})` - + '\\s*$') - -createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` - + '\\s+-\\s+' - + `(${src[t.XRANGEPLAINLOOSE]})` - + '\\s*$') - -// Star ranges basically just allow anything at all. -createToken('STAR', '(<|>)?=?\\s*\\*') -// >=0.0.0 is like a star -createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$') -createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') diff --git a/lib/client/src/views/project/component-manage/all/components/operation.vue b/lib/client/src/views/project/component-manage/all/components/operation.vue index 31f094339..271df01ac 100644 --- a/lib/client/src/views/project/component-manage/all/components/operation.vue +++ b/lib/client/src/views/project/component-manage/all/components/operation.vue @@ -108,7 +108,6 @@ - <%= require('raw-loader!./require-monaco.html').default %> diff --git a/lib/client/src/components/methods/forms/form-items/monaco.vue b/lib/client/src/components/methods/forms/form-items/monaco.vue index 9dacfc9ab..85f668ef2 100644 --- a/lib/client/src/components/methods/forms/form-items/monaco.vue +++ b/lib/client/src/components/methods/forms/form-items/monaco.vue @@ -75,6 +75,7 @@ import variableMixins from './variable-mixins' import { mapActions, mapGetters } from 'vuex' import LC from '@/element-materials/core' + import * as monacoEditor from 'monaco-editor'; import { FUNCTION_TIPS, FUNCTION_TYPE, @@ -298,14 +299,14 @@ if (isChart) { this.proposals.push({ label: `lesscode.${node.componentId}.${propKey}`, - kind: window.monaco.languages.CompletionItemKind.Property, + kind: monacoEditor.languages.CompletionItemKind.Property, documentation: this.$t('组件【{0}】的【{1}】属性的内置变量', [node.componentId, propKey]), insertText: `this.${perVariableName}` }) } else { this.proposals.push({ label: `lesscode.${node.componentId}.${propKey}`, - kind: window.monaco.languages.CompletionItemKind.Property, + kind: monacoEditor.languages.CompletionItemKind.Property, documentation: this.$t('组件【{0}】的【{1}】属性的内置变量', [node.componentId, propKey]), insertText: `this.${perVariableName}${camelCase(propKey, { transform: camelCaseTransformMerge })}` }) @@ -317,7 +318,7 @@ ) { this.proposals.push({ label: `lesscode.${node.componentId}.${propKey}.count`, - kind: window.monaco.languages.CompletionItemKind.Property, + kind: monacoEditor.languages.CompletionItemKind.Property, documentation: this.$t('组件【{0}】的【{1}.count】属性的内置变量', [node.componentId, propKey]), insertText: `this.${perVariableName}paginationCount` }) @@ -332,7 +333,7 @@ if (needShowInnerVariable && renderSlot.buildInVariableType !== BUILDIN_VARIABLE_TYPE_LIST[1].VAL) { this.proposals.push({ label: `lesscode.${node.componentId}.${config.displayName}`, - kind: window.monaco.languages.CompletionItemKind.Property, + kind: monacoEditor.languages.CompletionItemKind.Property, documentation: this.$t('组件【{0}】的【{1}】的内置变量', [node.componentId, config.displayName]), insertText: `this.${perVariableName}Slot${slotKey}` }) @@ -363,7 +364,7 @@ } this.proposals.push({ label: `lesscode.${functionData.funcName}`, - kind: window.monaco.languages.CompletionItemKind.Function, + kind: monacoEditor.languages.CompletionItemKind.Function, documentation, insertText: `lesscode['\${func:${functionData.funcCode}}'](${(functionData.funcParams || []).join(', ')})` }) @@ -384,7 +385,7 @@ } this.proposals.push({ label: `lesscode.${variableData.variableCode}`, - kind: window.monaco.languages.CompletionItemKind.Property, + kind: monacoEditor.languages.CompletionItemKind.Property, documentation, insertText: `lesscode['\$\{prop:${variableData.variableCode}\}']` }) diff --git a/lib/client/src/components/monaco.vue b/lib/client/src/components/monaco.vue index f8be935d3..7bd9890bd 100644 --- a/lib/client/src/components/monaco.vue +++ b/lib/client/src/components/monaco.vue @@ -21,6 +21,7 @@