@bleedingdev/modern-js-code-tools 3.5.0-ultramodern.30 → 3.5.0-ultramodern.32

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.
Files changed (41) hide show
  1. package/dist/cjs/oxlint-plugin/ast.cjs +187 -0
  2. package/dist/cjs/oxlint-plugin/options.cjs +172 -0
  3. package/dist/cjs/oxlint-plugin/rules/no-hardcoded-jsx-text.cjs +74 -0
  4. package/dist/cjs/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.cjs +61 -0
  5. package/dist/cjs/oxlint-plugin/rules/no-literal-visible-jsx-attributes.cjs +74 -0
  6. package/dist/cjs/oxlint-plugin/rules/no-manual-locale-copy-branching.cjs +80 -0
  7. package/dist/cjs/oxlint-plugin/rules/no-split-translation-keys.cjs +70 -0
  8. package/dist/cjs/oxlint-plugin/rules/strict-effect-api-boundaries.cjs +84 -0
  9. package/dist/cjs/oxlint-plugin/types.cjs +18 -0
  10. package/dist/cjs/oxlint-plugin.cjs +100 -382
  11. package/dist/esm/oxlint-plugin/ast.js +83 -0
  12. package/dist/esm/oxlint-plugin/options.js +89 -0
  13. package/dist/esm/oxlint-plugin/rules/no-hardcoded-jsx-text.js +36 -0
  14. package/dist/esm/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.js +23 -0
  15. package/dist/esm/oxlint-plugin/rules/no-literal-visible-jsx-attributes.js +36 -0
  16. package/dist/esm/oxlint-plugin/rules/no-manual-locale-copy-branching.js +42 -0
  17. package/dist/esm/oxlint-plugin/rules/no-split-translation-keys.js +32 -0
  18. package/dist/esm/oxlint-plugin/rules/strict-effect-api-boundaries.js +46 -0
  19. package/dist/esm/oxlint-plugin/types.js +0 -0
  20. package/dist/esm/oxlint-plugin.js +15 -367
  21. package/dist/esm-node/oxlint-plugin/ast.js +84 -0
  22. package/dist/esm-node/oxlint-plugin/options.js +90 -0
  23. package/dist/esm-node/oxlint-plugin/rules/no-hardcoded-jsx-text.js +37 -0
  24. package/dist/esm-node/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.js +24 -0
  25. package/dist/esm-node/oxlint-plugin/rules/no-literal-visible-jsx-attributes.js +37 -0
  26. package/dist/esm-node/oxlint-plugin/rules/no-manual-locale-copy-branching.js +43 -0
  27. package/dist/esm-node/oxlint-plugin/rules/no-split-translation-keys.js +33 -0
  28. package/dist/esm-node/oxlint-plugin/rules/strict-effect-api-boundaries.js +47 -0
  29. package/dist/esm-node/oxlint-plugin/types.js +1 -0
  30. package/dist/esm-node/oxlint-plugin.js +15 -367
  31. package/dist/types/oxlint-plugin/ast.d.ts +24 -0
  32. package/dist/types/oxlint-plugin/options.d.ts +62 -0
  33. package/dist/types/oxlint-plugin/rules/no-hardcoded-jsx-text.d.ts +2 -0
  34. package/dist/types/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.d.ts +2 -0
  35. package/dist/types/oxlint-plugin/rules/no-literal-visible-jsx-attributes.d.ts +2 -0
  36. package/dist/types/oxlint-plugin/rules/no-manual-locale-copy-branching.d.ts +2 -0
  37. package/dist/types/oxlint-plugin/rules/no-split-translation-keys.d.ts +2 -0
  38. package/dist/types/oxlint-plugin/rules/strict-effect-api-boundaries.d.ts +2 -0
  39. package/dist/types/oxlint-plugin/types.d.ts +60 -0
  40. package/dist/types/oxlint-plugin.d.ts +15 -56
  41. package/package.json +1 -1
@@ -0,0 +1,187 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ asStringArray: ()=>asStringArray,
32
+ expressionStringValue: ()=>expressionStringValue,
33
+ getCallExpressionName: ()=>getCallExpressionName,
34
+ getIgnorePattern: ()=>getIgnorePattern,
35
+ getJsxElementName: ()=>getJsxElementName,
36
+ getLine: ()=>getLine,
37
+ getNodeName: ()=>getNodeName,
38
+ getSourceText: ()=>getSourceText,
39
+ getStringLiteralValue: ()=>getStringLiteralValue,
40
+ getTemplateLiteralValue: ()=>getTemplateLiteralValue,
41
+ hasAllowedElementAncestor: ()=>hasAllowedElementAncestor,
42
+ hasIgnoreComment: ()=>hasIgnoreComment,
43
+ hasLetters: ()=>hasLetters,
44
+ isApiEntryFile: ()=>isApiEntryFile,
45
+ isApiSourceFile: ()=>isApiSourceFile,
46
+ isForbiddenGeneratedEffectPath: ()=>isForbiddenGeneratedEffectPath,
47
+ isRecord: ()=>isRecord,
48
+ isSharedApiContractFile: ()=>isSharedApiContractFile,
49
+ normalizeFilename: ()=>normalizeFilename,
50
+ normalizeVisibleText: ()=>normalizeVisibleText,
51
+ reportMissingProgramPattern: ()=>reportMissingProgramPattern,
52
+ reportProgramPattern: ()=>reportProgramPattern,
53
+ reportVisibleText: ()=>reportVisibleText
54
+ });
55
+ const external_options_cjs_namespaceObject = require("./options.cjs");
56
+ const isRecord = (value)=>Boolean(value) && 'object' == typeof value && !Array.isArray(value);
57
+ const asStringArray = (value, fallback)=>Array.isArray(value) && value.every((item)=>'string' == typeof item) ? value : fallback;
58
+ const normalizeVisibleText = (value)=>value.replaceAll(/\s+/gu, ' ').trim();
59
+ const hasLetters = (value)=>external_options_cjs_namespaceObject.LETTER_PATTERN.test(value);
60
+ const getNodeName = (node)=>{
61
+ if (!node) return;
62
+ if ('string' == typeof node.name) return node.name;
63
+ if ('JSXIdentifier' === node.type && isRecord(node.name) && 'string' == typeof node.name.name) return node.name.name;
64
+ if ('JSXIdentifier' === node.type && 'string' == typeof node.name) return node.name;
65
+ if (('JSXMemberExpression' === node.type || 'MemberExpression' === node.type) && isRecord(node.property) && true !== node.computed) {
66
+ const objectName = getNodeName(node.object);
67
+ const propertyName = getNodeName(node.property);
68
+ return objectName && propertyName ? `${objectName}.${propertyName}` : propertyName;
69
+ }
70
+ };
71
+ const getJsxElementName = (node)=>{
72
+ if (node?.type !== 'JSXElement') return;
73
+ return getNodeName(node.openingElement?.name);
74
+ };
75
+ const hasAllowedElementAncestor = (node, allowedElements)=>{
76
+ let current = node;
77
+ while(current){
78
+ const elementName = getJsxElementName(current);
79
+ if (elementName && allowedElements.has(elementName)) return true;
80
+ current = current.parent;
81
+ }
82
+ return false;
83
+ };
84
+ const getTemplateLiteralValue = (node)=>{
85
+ if ('TemplateLiteral' !== node.type || (node.expressions?.length ?? 0) > 0) return;
86
+ const quasi = node.quasis?.[0];
87
+ if (!isRecord(quasi?.value)) return;
88
+ const cooked = quasi.value.cooked;
89
+ const raw = quasi.value.raw;
90
+ return 'string' == typeof cooked ? cooked : 'string' == typeof raw ? raw : void 0;
91
+ };
92
+ const getStringLiteralValue = (node)=>{
93
+ if (!node) return;
94
+ if (('Literal' === node.type || 'StringLiteral' === node.type) && 'string' == typeof node.value) return node.value;
95
+ return getTemplateLiteralValue(node);
96
+ };
97
+ const expressionStringValue = (node)=>getStringLiteralValue(node?.type === 'JSXExpressionContainer' ? node.expression : node);
98
+ const getLine = (node)=>node.loc?.start?.line;
99
+ const hasIgnoreComment = (node, context, pattern)=>{
100
+ const sourceCode = context.getSourceCode?.();
101
+ const nodeLine = getLine(node);
102
+ if (!sourceCode?.getAllComments || void 0 === nodeLine) return false;
103
+ return sourceCode.getAllComments().some((comment)=>{
104
+ const commentValue = String(comment.value ?? '');
105
+ if (!pattern.test(commentValue)) return false;
106
+ const startLine = comment.loc?.start?.line;
107
+ const endLine = comment.loc?.end?.line ?? startLine;
108
+ return void 0 !== startLine && void 0 !== endLine && startLine <= nodeLine + 1 && endLine >= nodeLine - 1;
109
+ });
110
+ };
111
+ const getIgnorePattern = (options)=>new RegExp(options.ignoreCommentPattern, 'u');
112
+ const reportVisibleText = (context, node, text)=>{
113
+ context.report({
114
+ node,
115
+ message: `Move user-visible JSX text to locale resources: ${JSON.stringify(text)}`
116
+ });
117
+ };
118
+ const getSourceText = (context, node)=>context.getSourceCode?.().getText?.(node) ?? context.getSourceCode?.().text ?? '';
119
+ const normalizeFilename = (filePath)=>(filePath ?? '').replaceAll('\\', '/');
120
+ const isApiSourceFile = (filePath)=>external_options_cjs_namespaceObject.API_SOURCE_FILE_PATTERN.test(normalizeFilename(filePath));
121
+ const isForbiddenGeneratedEffectPath = (filePath)=>external_options_cjs_namespaceObject.FORBIDDEN_GENERATED_EFFECT_PATH_PATTERN.test(normalizeFilename(filePath));
122
+ const isApiEntryFile = (filePath)=>external_options_cjs_namespaceObject.API_ENTRY_PATTERN.test(normalizeFilename(filePath));
123
+ const isSharedApiContractFile = (filePath)=>external_options_cjs_namespaceObject.SHARED_API_CONTRACT_PATTERN.test(normalizeFilename(filePath));
124
+ const getCallExpressionName = (node)=>getNodeName(node);
125
+ const reportProgramPattern = (context, node, source, pattern, message)=>{
126
+ if (pattern.test(source)) context.report({
127
+ node,
128
+ message
129
+ });
130
+ };
131
+ const reportMissingProgramPattern = (context, node, source, pattern, message)=>{
132
+ if (!pattern.test(source)) context.report({
133
+ node,
134
+ message
135
+ });
136
+ };
137
+ exports.asStringArray = __webpack_exports__.asStringArray;
138
+ exports.expressionStringValue = __webpack_exports__.expressionStringValue;
139
+ exports.getCallExpressionName = __webpack_exports__.getCallExpressionName;
140
+ exports.getIgnorePattern = __webpack_exports__.getIgnorePattern;
141
+ exports.getJsxElementName = __webpack_exports__.getJsxElementName;
142
+ exports.getLine = __webpack_exports__.getLine;
143
+ exports.getNodeName = __webpack_exports__.getNodeName;
144
+ exports.getSourceText = __webpack_exports__.getSourceText;
145
+ exports.getStringLiteralValue = __webpack_exports__.getStringLiteralValue;
146
+ exports.getTemplateLiteralValue = __webpack_exports__.getTemplateLiteralValue;
147
+ exports.hasAllowedElementAncestor = __webpack_exports__.hasAllowedElementAncestor;
148
+ exports.hasIgnoreComment = __webpack_exports__.hasIgnoreComment;
149
+ exports.hasLetters = __webpack_exports__.hasLetters;
150
+ exports.isApiEntryFile = __webpack_exports__.isApiEntryFile;
151
+ exports.isApiSourceFile = __webpack_exports__.isApiSourceFile;
152
+ exports.isForbiddenGeneratedEffectPath = __webpack_exports__.isForbiddenGeneratedEffectPath;
153
+ exports.isRecord = __webpack_exports__.isRecord;
154
+ exports.isSharedApiContractFile = __webpack_exports__.isSharedApiContractFile;
155
+ exports.normalizeFilename = __webpack_exports__.normalizeFilename;
156
+ exports.normalizeVisibleText = __webpack_exports__.normalizeVisibleText;
157
+ exports.reportMissingProgramPattern = __webpack_exports__.reportMissingProgramPattern;
158
+ exports.reportProgramPattern = __webpack_exports__.reportProgramPattern;
159
+ exports.reportVisibleText = __webpack_exports__.reportVisibleText;
160
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
161
+ "asStringArray",
162
+ "expressionStringValue",
163
+ "getCallExpressionName",
164
+ "getIgnorePattern",
165
+ "getJsxElementName",
166
+ "getLine",
167
+ "getNodeName",
168
+ "getSourceText",
169
+ "getStringLiteralValue",
170
+ "getTemplateLiteralValue",
171
+ "hasAllowedElementAncestor",
172
+ "hasIgnoreComment",
173
+ "hasLetters",
174
+ "isApiEntryFile",
175
+ "isApiSourceFile",
176
+ "isForbiddenGeneratedEffectPath",
177
+ "isRecord",
178
+ "isSharedApiContractFile",
179
+ "normalizeFilename",
180
+ "normalizeVisibleText",
181
+ "reportMissingProgramPattern",
182
+ "reportProgramPattern",
183
+ "reportVisibleText"
184
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
185
+ Object.defineProperty(exports, '__esModule', {
186
+ value: true
187
+ });
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ API_ENTRY_PATTERN: ()=>API_ENTRY_PATTERN,
32
+ API_SOURCE_FILE_PATTERN: ()=>API_SOURCE_FILE_PATTERN,
33
+ DEFAULT_ALLOWED_ELEMENTS: ()=>DEFAULT_ALLOWED_ELEMENTS,
34
+ DEFAULT_IGNORE_COMMENT_PATTERN: ()=>DEFAULT_IGNORE_COMMENT_PATTERN,
35
+ DEFAULT_TRANSLATION_FUNCTIONS: ()=>DEFAULT_TRANSLATION_FUNCTIONS,
36
+ DEFAULT_VISIBLE_ATTRIBUTES: ()=>DEFAULT_VISIBLE_ATTRIBUTES,
37
+ FORBIDDEN_GENERATED_EFFECT_PATH_PATTERN: ()=>FORBIDDEN_GENERATED_EFFECT_PATH_PATTERN,
38
+ LETTER_PATTERN: ()=>LETTER_PATTERN,
39
+ SHARED_API_CONTRACT_PATTERN: ()=>SHARED_API_CONTRACT_PATTERN,
40
+ SPLIT_TRANSLATION_KEY_PATTERN: ()=>SPLIT_TRANSLATION_KEY_PATTERN,
41
+ attributeOptionsSchema: ()=>attributeOptionsSchema,
42
+ commonOptionsSchema: ()=>commonOptionsSchema,
43
+ getAttributeRuleOption: ()=>getAttributeRuleOption,
44
+ getCommonRuleOption: ()=>getCommonRuleOption,
45
+ getSplitTranslationKeyRuleOption: ()=>getSplitTranslationKeyRuleOption,
46
+ translationOptionsSchema: ()=>translationOptionsSchema
47
+ });
48
+ const external_ast_cjs_namespaceObject = require("./ast.cjs");
49
+ const commonOptionsSchema = {
50
+ type: 'object',
51
+ properties: {
52
+ allowElements: {
53
+ type: 'array',
54
+ items: {
55
+ type: 'string'
56
+ }
57
+ },
58
+ ignoreCommentPattern: {
59
+ type: 'string'
60
+ }
61
+ },
62
+ additionalProperties: false
63
+ };
64
+ const attributeOptionsSchema = {
65
+ type: 'object',
66
+ properties: {
67
+ ...commonOptionsSchema.properties,
68
+ visibleAttributes: {
69
+ type: 'array',
70
+ items: {
71
+ type: 'string'
72
+ }
73
+ }
74
+ },
75
+ additionalProperties: false
76
+ };
77
+ const translationOptionsSchema = {
78
+ type: 'object',
79
+ properties: {
80
+ translationFunctions: {
81
+ type: 'array',
82
+ items: {
83
+ type: 'string'
84
+ }
85
+ }
86
+ },
87
+ additionalProperties: false
88
+ };
89
+ const DEFAULT_VISIBLE_ATTRIBUTES = [
90
+ 'aria-label',
91
+ "aria-description",
92
+ "aria-roledescription",
93
+ 'aria-valuetext',
94
+ 'alt',
95
+ 'placeholder',
96
+ 'title'
97
+ ];
98
+ const DEFAULT_ALLOWED_ELEMENTS = [
99
+ 'code',
100
+ 'kbd',
101
+ 'samp'
102
+ ];
103
+ const DEFAULT_TRANSLATION_FUNCTIONS = [
104
+ 't'
105
+ ];
106
+ const DEFAULT_IGNORE_COMMENT_PATTERN = 'i18n-ignore';
107
+ const LETTER_PATTERN = /\p{L}/u;
108
+ const SPLIT_TRANSLATION_KEY_PATTERN = /\.(?:prefix|suffix|before|after)$/u;
109
+ const API_SOURCE_FILE_PATTERN = /(?:^|\/)(?:api\/|shared\/api\.[cm]?[jt]sx?$)/u;
110
+ const FORBIDDEN_GENERATED_EFFECT_PATH_PATTERN = /(?:^|\/)(?:(?:apps|verticals)\/[^/]+\/(?:api\/(?:effect|lambda)|shared\/effect|src\/effect))(?:\/|$)/u;
111
+ const API_ENTRY_PATTERN = /(?:^|\/)(?:apps|verticals)\/[^/]+\/api\/index\.[cm]?[jt]sx?$/u;
112
+ const SHARED_API_CONTRACT_PATTERN = /(?:^|\/)(?:apps|verticals)\/[^/]+\/shared\/api\.[cm]?[jt]sx?$/u;
113
+ const getCommonRuleOption = (context, defaults)=>{
114
+ const options = context.options?.[0];
115
+ if (!(0, external_ast_cjs_namespaceObject.isRecord)(options)) return defaults;
116
+ return {
117
+ allowElements: (0, external_ast_cjs_namespaceObject.asStringArray)(options.allowElements, defaults.allowElements),
118
+ ignoreCommentPattern: 'string' == typeof options.ignoreCommentPattern ? options.ignoreCommentPattern : defaults.ignoreCommentPattern
119
+ };
120
+ };
121
+ const getAttributeRuleOption = (context, defaults)=>{
122
+ const options = context.options?.[0];
123
+ const commonOptions = getCommonRuleOption(context, defaults);
124
+ return {
125
+ ...commonOptions,
126
+ visibleAttributes: (0, external_ast_cjs_namespaceObject.isRecord)(options) ? (0, external_ast_cjs_namespaceObject.asStringArray)(options.visibleAttributes, defaults.visibleAttributes) : defaults.visibleAttributes
127
+ };
128
+ };
129
+ const getSplitTranslationKeyRuleOption = (context, defaults)=>{
130
+ const options = context.options?.[0];
131
+ if (!(0, external_ast_cjs_namespaceObject.isRecord)(options)) return defaults;
132
+ return {
133
+ translationFunctions: (0, external_ast_cjs_namespaceObject.asStringArray)(options.translationFunctions, defaults.translationFunctions)
134
+ };
135
+ };
136
+ exports.API_ENTRY_PATTERN = __webpack_exports__.API_ENTRY_PATTERN;
137
+ exports.API_SOURCE_FILE_PATTERN = __webpack_exports__.API_SOURCE_FILE_PATTERN;
138
+ exports.DEFAULT_ALLOWED_ELEMENTS = __webpack_exports__.DEFAULT_ALLOWED_ELEMENTS;
139
+ exports.DEFAULT_IGNORE_COMMENT_PATTERN = __webpack_exports__.DEFAULT_IGNORE_COMMENT_PATTERN;
140
+ exports.DEFAULT_TRANSLATION_FUNCTIONS = __webpack_exports__.DEFAULT_TRANSLATION_FUNCTIONS;
141
+ exports.DEFAULT_VISIBLE_ATTRIBUTES = __webpack_exports__.DEFAULT_VISIBLE_ATTRIBUTES;
142
+ exports.FORBIDDEN_GENERATED_EFFECT_PATH_PATTERN = __webpack_exports__.FORBIDDEN_GENERATED_EFFECT_PATH_PATTERN;
143
+ exports.LETTER_PATTERN = __webpack_exports__.LETTER_PATTERN;
144
+ exports.SHARED_API_CONTRACT_PATTERN = __webpack_exports__.SHARED_API_CONTRACT_PATTERN;
145
+ exports.SPLIT_TRANSLATION_KEY_PATTERN = __webpack_exports__.SPLIT_TRANSLATION_KEY_PATTERN;
146
+ exports.attributeOptionsSchema = __webpack_exports__.attributeOptionsSchema;
147
+ exports.commonOptionsSchema = __webpack_exports__.commonOptionsSchema;
148
+ exports.getAttributeRuleOption = __webpack_exports__.getAttributeRuleOption;
149
+ exports.getCommonRuleOption = __webpack_exports__.getCommonRuleOption;
150
+ exports.getSplitTranslationKeyRuleOption = __webpack_exports__.getSplitTranslationKeyRuleOption;
151
+ exports.translationOptionsSchema = __webpack_exports__.translationOptionsSchema;
152
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
153
+ "API_ENTRY_PATTERN",
154
+ "API_SOURCE_FILE_PATTERN",
155
+ "DEFAULT_ALLOWED_ELEMENTS",
156
+ "DEFAULT_IGNORE_COMMENT_PATTERN",
157
+ "DEFAULT_TRANSLATION_FUNCTIONS",
158
+ "DEFAULT_VISIBLE_ATTRIBUTES",
159
+ "FORBIDDEN_GENERATED_EFFECT_PATH_PATTERN",
160
+ "LETTER_PATTERN",
161
+ "SHARED_API_CONTRACT_PATTERN",
162
+ "SPLIT_TRANSLATION_KEY_PATTERN",
163
+ "attributeOptionsSchema",
164
+ "commonOptionsSchema",
165
+ "getAttributeRuleOption",
166
+ "getCommonRuleOption",
167
+ "getSplitTranslationKeyRuleOption",
168
+ "translationOptionsSchema"
169
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
170
+ Object.defineProperty(exports, '__esModule', {
171
+ value: true
172
+ });
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ createNoHardcodedJsxTextRule: ()=>createNoHardcodedJsxTextRule
32
+ });
33
+ const external_ast_cjs_namespaceObject = require("../ast.cjs");
34
+ const external_options_cjs_namespaceObject = require("../options.cjs");
35
+ const createNoHardcodedJsxTextRule = ()=>({
36
+ meta: {
37
+ type: 'problem',
38
+ docs: {
39
+ description: 'Disallow literal user-visible text in JSX children in UltraModern generated apps.'
40
+ },
41
+ schema: [
42
+ external_options_cjs_namespaceObject.commonOptionsSchema
43
+ ]
44
+ },
45
+ create (context) {
46
+ const options = (0, external_options_cjs_namespaceObject.getCommonRuleOption)(context, {
47
+ allowElements: external_options_cjs_namespaceObject.DEFAULT_ALLOWED_ELEMENTS,
48
+ ignoreCommentPattern: external_options_cjs_namespaceObject.DEFAULT_IGNORE_COMMENT_PATTERN
49
+ });
50
+ const allowedElements = new Set(options.allowElements);
51
+ const ignorePattern = (0, external_ast_cjs_namespaceObject.getIgnorePattern)(options);
52
+ const shouldSkipNode = (node)=>(0, external_ast_cjs_namespaceObject.hasAllowedElementAncestor)(node, allowedElements) || (0, external_ast_cjs_namespaceObject.hasIgnoreComment)(node, context, ignorePattern);
53
+ return {
54
+ JSXText (node) {
55
+ const text = (0, external_ast_cjs_namespaceObject.normalizeVisibleText)(String(node.value ?? ''));
56
+ if (!text || !(0, external_ast_cjs_namespaceObject.hasLetters)(text) || shouldSkipNode(node)) return;
57
+ (0, external_ast_cjs_namespaceObject.reportVisibleText)(context, node, text);
58
+ },
59
+ JSXExpressionContainer (node) {
60
+ if (node.parent?.type !== 'JSXElement' && node.parent?.type !== 'JSXFragment') return;
61
+ const text = (0, external_ast_cjs_namespaceObject.normalizeVisibleText)((0, external_ast_cjs_namespaceObject.expressionStringValue)(node.expression) ?? '');
62
+ if (!text || !(0, external_ast_cjs_namespaceObject.hasLetters)(text) || shouldSkipNode(node)) return;
63
+ (0, external_ast_cjs_namespaceObject.reportVisibleText)(context, node, text);
64
+ }
65
+ };
66
+ }
67
+ });
68
+ exports.createNoHardcodedJsxTextRule = __webpack_exports__.createNoHardcodedJsxTextRule;
69
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
70
+ "createNoHardcodedJsxTextRule"
71
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
72
+ Object.defineProperty(exports, '__esModule', {
73
+ value: true
74
+ });
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ createNoLegacyMfBoundaryAttributesRule: ()=>createNoLegacyMfBoundaryAttributesRule
32
+ });
33
+ const external_ast_cjs_namespaceObject = require("../ast.cjs");
34
+ const createNoLegacyMfBoundaryAttributesRule = ()=>({
35
+ meta: {
36
+ type: 'problem',
37
+ docs: {
38
+ description: 'Disallow legacy Module Federation boundary attributes in generated UltraModern workspaces.'
39
+ },
40
+ schema: []
41
+ },
42
+ create (context) {
43
+ return {
44
+ JSXAttribute (node) {
45
+ const attributeName = (0, external_ast_cjs_namespaceObject.getNodeName)(node.name);
46
+ if ('data-mf-boundary' !== attributeName && 'data-mf-remote' !== attributeName && 'data-mf-expose' !== attributeName) return;
47
+ context.report({
48
+ node,
49
+ message: 'Use data-modern-boundary-id and data-modern-mf-expose instead of legacy data-mf-* boundary attributes.'
50
+ });
51
+ }
52
+ };
53
+ }
54
+ });
55
+ exports.createNoLegacyMfBoundaryAttributesRule = __webpack_exports__.createNoLegacyMfBoundaryAttributesRule;
56
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
57
+ "createNoLegacyMfBoundaryAttributesRule"
58
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
59
+ Object.defineProperty(exports, '__esModule', {
60
+ value: true
61
+ });
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ createNoLiteralVisibleJsxAttributesRule: ()=>createNoLiteralVisibleJsxAttributesRule
32
+ });
33
+ const external_ast_cjs_namespaceObject = require("../ast.cjs");
34
+ const external_options_cjs_namespaceObject = require("../options.cjs");
35
+ const createNoLiteralVisibleJsxAttributesRule = ()=>({
36
+ meta: {
37
+ type: 'problem',
38
+ docs: {
39
+ description: 'Disallow literal user-visible JSX attribute text in UltraModern generated apps.'
40
+ },
41
+ schema: [
42
+ external_options_cjs_namespaceObject.attributeOptionsSchema
43
+ ]
44
+ },
45
+ create (context) {
46
+ const options = (0, external_options_cjs_namespaceObject.getAttributeRuleOption)(context, {
47
+ allowElements: external_options_cjs_namespaceObject.DEFAULT_ALLOWED_ELEMENTS,
48
+ ignoreCommentPattern: external_options_cjs_namespaceObject.DEFAULT_IGNORE_COMMENT_PATTERN,
49
+ visibleAttributes: external_options_cjs_namespaceObject.DEFAULT_VISIBLE_ATTRIBUTES
50
+ });
51
+ const visibleAttributes = new Set(options.visibleAttributes);
52
+ const allowedElements = new Set(options.allowElements);
53
+ const ignorePattern = (0, external_ast_cjs_namespaceObject.getIgnorePattern)(options);
54
+ return {
55
+ JSXAttribute (node) {
56
+ const attributeName = (0, external_ast_cjs_namespaceObject.getNodeName)(node.name);
57
+ if (!attributeName || !visibleAttributes.has(attributeName)) return;
58
+ const text = (0, external_ast_cjs_namespaceObject.normalizeVisibleText)((0, external_ast_cjs_namespaceObject.expressionStringValue)(node.value) ?? '');
59
+ if (!text || !(0, external_ast_cjs_namespaceObject.hasLetters)(text) || (0, external_ast_cjs_namespaceObject.hasAllowedElementAncestor)(node, allowedElements) || (0, external_ast_cjs_namespaceObject.hasIgnoreComment)(node, context, ignorePattern)) return;
60
+ context.report({
61
+ node,
62
+ message: `Move literal ${attributeName} copy to locale resources: ${JSON.stringify(text)}`
63
+ });
64
+ }
65
+ };
66
+ }
67
+ });
68
+ exports.createNoLiteralVisibleJsxAttributesRule = __webpack_exports__.createNoLiteralVisibleJsxAttributesRule;
69
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
70
+ "createNoLiteralVisibleJsxAttributesRule"
71
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
72
+ Object.defineProperty(exports, '__esModule', {
73
+ value: true
74
+ });
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ createNoManualLocaleCopyBranchingRule: ()=>createNoManualLocaleCopyBranchingRule
32
+ });
33
+ const external_ast_cjs_namespaceObject = require("../ast.cjs");
34
+ const looksLikeLocaleTest = (context, node)=>{
35
+ const text = (0, external_ast_cjs_namespaceObject.getSourceText)(context, node);
36
+ return /\b(?:language|locale|lng|currentLanguage)\b/u.test(text) && /(?:={2,3}|!==?|\.\s*startsWith\s*\()/u.test(text) && /['"][a-z]{2}(?:-[A-Za-z0-9]+)?['"]/u.test(text);
37
+ };
38
+ const isAllowedBranchLiteral = (text)=>new Set([
39
+ 'page',
40
+ 'undefined',
41
+ 'null',
42
+ 'true',
43
+ 'false'
44
+ ]).has(text);
45
+ const createNoManualLocaleCopyBranchingRule = ()=>({
46
+ meta: {
47
+ type: 'problem',
48
+ docs: {
49
+ description: 'Disallow manual locale conditionals that choose user-visible copy.'
50
+ },
51
+ schema: []
52
+ },
53
+ create (context) {
54
+ const reportBranch = (node, text)=>{
55
+ context.report({
56
+ node,
57
+ message: `Move locale-specific copy branch to i18n resources: ${JSON.stringify(normalizeVisibleText(text))}`
58
+ });
59
+ };
60
+ return {
61
+ ConditionalExpression (node) {
62
+ if (!node.test || !looksLikeLocaleTest(context, node.test)) return;
63
+ for (const branch of [
64
+ node.consequent,
65
+ node.alternate
66
+ ]){
67
+ const text = expressionStringValue(branch);
68
+ if (text && hasLetters(text) && !isAllowedBranchLiteral(text.trim())) reportBranch(branch, text);
69
+ }
70
+ }
71
+ };
72
+ }
73
+ });
74
+ exports.createNoManualLocaleCopyBranchingRule = __webpack_exports__.createNoManualLocaleCopyBranchingRule;
75
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
76
+ "createNoManualLocaleCopyBranchingRule"
77
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
78
+ Object.defineProperty(exports, '__esModule', {
79
+ value: true
80
+ });