@bleedingdev/modern-js-code-tools 3.5.0-ultramodern.9 → 3.5.0-ultramodern.91

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 (49) hide show
  1. package/dist/cjs/cli/i18n-check.cjs +0 -6
  2. package/dist/cjs/cli/workspace-source-check.cjs +0 -3
  3. package/dist/cjs/oxlint-plugin/ast.cjs +181 -0
  4. package/dist/cjs/oxlint-plugin/options.cjs +172 -0
  5. package/dist/cjs/oxlint-plugin/rules/no-hardcoded-jsx-text.cjs +82 -0
  6. package/dist/cjs/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.cjs +61 -0
  7. package/dist/cjs/oxlint-plugin/rules/no-literal-visible-jsx-attributes.cjs +74 -0
  8. package/dist/cjs/oxlint-plugin/rules/no-manual-locale-copy-branching.cjs +80 -0
  9. package/dist/cjs/oxlint-plugin/rules/no-split-translation-keys.cjs +70 -0
  10. package/dist/cjs/oxlint-plugin/rules/strict-effect-api-boundaries.cjs +84 -0
  11. package/dist/cjs/oxlint-plugin/types.cjs +18 -0
  12. package/dist/cjs/oxlint-plugin.cjs +100 -382
  13. package/dist/esm/cli/i18n-check.js +1 -1
  14. package/dist/esm/cli/workspace-source-check.js +1 -1
  15. package/dist/esm/oxlint-plugin/ast.js +83 -0
  16. package/dist/esm/oxlint-plugin/options.js +89 -0
  17. package/dist/esm/oxlint-plugin/rules/no-hardcoded-jsx-text.js +44 -0
  18. package/dist/esm/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.js +23 -0
  19. package/dist/esm/oxlint-plugin/rules/no-literal-visible-jsx-attributes.js +36 -0
  20. package/dist/esm/oxlint-plugin/rules/no-manual-locale-copy-branching.js +42 -0
  21. package/dist/esm/oxlint-plugin/rules/no-split-translation-keys.js +32 -0
  22. package/dist/esm/oxlint-plugin/rules/strict-effect-api-boundaries.js +46 -0
  23. package/dist/esm/oxlint-plugin/types.js +0 -0
  24. package/dist/esm/oxlint-plugin.js +15 -367
  25. package/dist/esm-node/cli/i18n-check.js +1 -1
  26. package/dist/esm-node/cli/workspace-source-check.js +1 -1
  27. package/dist/esm-node/oxlint-plugin/ast.js +84 -0
  28. package/dist/esm-node/oxlint-plugin/options.js +90 -0
  29. package/dist/esm-node/oxlint-plugin/rules/no-hardcoded-jsx-text.js +45 -0
  30. package/dist/esm-node/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.js +24 -0
  31. package/dist/esm-node/oxlint-plugin/rules/no-literal-visible-jsx-attributes.js +37 -0
  32. package/dist/esm-node/oxlint-plugin/rules/no-manual-locale-copy-branching.js +43 -0
  33. package/dist/esm-node/oxlint-plugin/rules/no-split-translation-keys.js +33 -0
  34. package/dist/esm-node/oxlint-plugin/rules/strict-effect-api-boundaries.js +47 -0
  35. package/dist/esm-node/oxlint-plugin/types.js +1 -0
  36. package/dist/esm-node/oxlint-plugin.js +15 -367
  37. package/dist/types/cli/i18n-check.d.ts +0 -2
  38. package/dist/types/cli/workspace-source-check.d.ts +0 -1
  39. package/dist/types/oxlint-plugin/ast.d.ts +22 -0
  40. package/dist/types/oxlint-plugin/options.d.ts +62 -0
  41. package/dist/types/oxlint-plugin/rules/no-hardcoded-jsx-text.d.ts +2 -0
  42. package/dist/types/oxlint-plugin/rules/no-legacy-mf-boundary-attributes.d.ts +2 -0
  43. package/dist/types/oxlint-plugin/rules/no-literal-visible-jsx-attributes.d.ts +2 -0
  44. package/dist/types/oxlint-plugin/rules/no-manual-locale-copy-branching.d.ts +2 -0
  45. package/dist/types/oxlint-plugin/rules/no-split-translation-keys.d.ts +2 -0
  46. package/dist/types/oxlint-plugin/rules/strict-effect-api-boundaries.d.ts +2 -0
  47. package/dist/types/oxlint-plugin/types.d.ts +60 -0
  48. package/dist/types/oxlint-plugin.d.ts +15 -56
  49. package/package.json +6 -7
@@ -28,8 +28,6 @@ var __webpack_require__ = {};
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  __webpack_require__.d(__webpack_exports__, {
31
- SINGLE_APP_I18N_FAILURE: ()=>SINGLE_APP_I18N_FAILURE,
32
- SINGLE_APP_I18N_SUCCESS: ()=>SINGLE_APP_I18N_SUCCESS,
33
31
  main: ()=>main,
34
32
  runSingleAppI18nCheck: ()=>runSingleAppI18nCheck
35
33
  });
@@ -58,13 +56,9 @@ const runSingleAppI18nCheck = ({ cwd = process.cwd(), targets = [
58
56
  const main = ()=>{
59
57
  process.exitCode = runSingleAppI18nCheck();
60
58
  };
61
- exports.SINGLE_APP_I18N_FAILURE = __webpack_exports__.SINGLE_APP_I18N_FAILURE;
62
- exports.SINGLE_APP_I18N_SUCCESS = __webpack_exports__.SINGLE_APP_I18N_SUCCESS;
63
59
  exports.main = __webpack_exports__.main;
64
60
  exports.runSingleAppI18nCheck = __webpack_exports__.runSingleAppI18nCheck;
65
61
  for(var __rspack_i in __webpack_exports__)if (-1 === [
66
- "SINGLE_APP_I18N_FAILURE",
67
- "SINGLE_APP_I18N_SUCCESS",
68
62
  "main",
69
63
  "runSingleAppI18nCheck"
70
64
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
@@ -37,7 +37,6 @@ var __webpack_require__ = {};
37
37
  var __webpack_exports__ = {};
38
38
  __webpack_require__.r(__webpack_exports__);
39
39
  __webpack_require__.d(__webpack_exports__, {
40
- WORKSPACE_SOURCE_SUCCESS: ()=>WORKSPACE_SOURCE_SUCCESS,
41
40
  main: ()=>main,
42
41
  runWorkspaceSourceCheck: ()=>runWorkspaceSourceCheck
43
42
  });
@@ -187,11 +186,9 @@ const runWorkspaceSourceCheck = ({ cwd = process.cwd(), sourceRoots = [
187
186
  const main = ()=>{
188
187
  process.exitCode = runWorkspaceSourceCheck();
189
188
  };
190
- exports.WORKSPACE_SOURCE_SUCCESS = __webpack_exports__.WORKSPACE_SOURCE_SUCCESS;
191
189
  exports.main = __webpack_exports__.main;
192
190
  exports.runWorkspaceSourceCheck = __webpack_exports__.runWorkspaceSourceCheck;
193
191
  for(var __rspack_i in __webpack_exports__)if (-1 === [
194
- "WORKSPACE_SOURCE_SUCCESS",
195
192
  "main",
196
193
  "runWorkspaceSourceCheck"
197
194
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
@@ -0,0 +1,181 @@
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
+ getLine: ()=>getLine,
36
+ getNodeName: ()=>getNodeName,
37
+ getSourceText: ()=>getSourceText,
38
+ getStringLiteralValue: ()=>getStringLiteralValue,
39
+ hasAllowedElementAncestor: ()=>hasAllowedElementAncestor,
40
+ hasIgnoreComment: ()=>hasIgnoreComment,
41
+ hasLetters: ()=>hasLetters,
42
+ isApiEntryFile: ()=>isApiEntryFile,
43
+ isApiSourceFile: ()=>isApiSourceFile,
44
+ isForbiddenGeneratedEffectPath: ()=>isForbiddenGeneratedEffectPath,
45
+ isRecord: ()=>isRecord,
46
+ isSharedApiContractFile: ()=>isSharedApiContractFile,
47
+ normalizeFilename: ()=>normalizeFilename,
48
+ normalizeVisibleText: ()=>normalizeVisibleText,
49
+ reportMissingProgramPattern: ()=>reportMissingProgramPattern,
50
+ reportProgramPattern: ()=>reportProgramPattern,
51
+ reportVisibleText: ()=>reportVisibleText
52
+ });
53
+ const external_options_cjs_namespaceObject = require("./options.cjs");
54
+ const isRecord = (value)=>Boolean(value) && 'object' == typeof value && !Array.isArray(value);
55
+ const asStringArray = (value, fallback)=>Array.isArray(value) && value.every((item)=>'string' == typeof item) ? value : fallback;
56
+ const normalizeVisibleText = (value)=>value.replaceAll(/\s+/gu, ' ').trim();
57
+ const hasLetters = (value)=>external_options_cjs_namespaceObject.LETTER_PATTERN.test(value);
58
+ const getNodeName = (node)=>{
59
+ if (!node) return;
60
+ if ('string' == typeof node.name) return node.name;
61
+ if ('JSXIdentifier' === node.type && isRecord(node.name) && 'string' == typeof node.name.name) return node.name.name;
62
+ if ('JSXIdentifier' === node.type && 'string' == typeof node.name) return node.name;
63
+ if (('JSXMemberExpression' === node.type || 'MemberExpression' === node.type) && isRecord(node.property) && true !== node.computed) {
64
+ const objectName = getNodeName(node.object);
65
+ const propertyName = getNodeName(node.property);
66
+ return objectName && propertyName ? `${objectName}.${propertyName}` : propertyName;
67
+ }
68
+ };
69
+ const getJsxElementName = (node)=>{
70
+ if (node?.type !== 'JSXElement') return;
71
+ return getNodeName(node.openingElement?.name);
72
+ };
73
+ const hasAllowedElementAncestor = (node, allowedElements)=>{
74
+ let current = node;
75
+ while(current){
76
+ const elementName = getJsxElementName(current);
77
+ if (elementName && allowedElements.has(elementName)) return true;
78
+ current = current.parent;
79
+ }
80
+ return false;
81
+ };
82
+ const getTemplateLiteralValue = (node)=>{
83
+ if ('TemplateLiteral' !== node.type || (node.expressions?.length ?? 0) > 0) return;
84
+ const quasi = node.quasis?.[0];
85
+ if (!isRecord(quasi?.value)) return;
86
+ const cooked = quasi.value.cooked;
87
+ const raw = quasi.value.raw;
88
+ return 'string' == typeof cooked ? cooked : 'string' == typeof raw ? raw : void 0;
89
+ };
90
+ const getStringLiteralValue = (node)=>{
91
+ if (!node) return;
92
+ if (('Literal' === node.type || 'StringLiteral' === node.type) && 'string' == typeof node.value) return node.value;
93
+ return getTemplateLiteralValue(node);
94
+ };
95
+ const expressionStringValue = (node)=>getStringLiteralValue(node?.type === 'JSXExpressionContainer' ? node.expression : node);
96
+ const getLine = (node)=>node.loc?.start?.line;
97
+ const hasIgnoreComment = (node, context, pattern)=>{
98
+ const sourceCode = context.getSourceCode?.();
99
+ const nodeLine = getLine(node);
100
+ if (!sourceCode?.getAllComments || void 0 === nodeLine) return false;
101
+ return sourceCode.getAllComments().some((comment)=>{
102
+ const commentValue = String(comment.value ?? '');
103
+ if (!pattern.test(commentValue)) return false;
104
+ const startLine = comment.loc?.start?.line;
105
+ const endLine = comment.loc?.end?.line ?? startLine;
106
+ return void 0 !== startLine && void 0 !== endLine && startLine <= nodeLine + 1 && endLine >= nodeLine - 1;
107
+ });
108
+ };
109
+ const getIgnorePattern = (options)=>new RegExp(options.ignoreCommentPattern, 'u');
110
+ const reportVisibleText = (context, node, text)=>{
111
+ context.report({
112
+ node,
113
+ message: `Move user-visible JSX text to locale resources: ${JSON.stringify(text)}`
114
+ });
115
+ };
116
+ const getSourceText = (context, node)=>context.getSourceCode?.().getText?.(node) ?? context.getSourceCode?.().text ?? '';
117
+ const normalizeFilename = (filePath)=>(filePath ?? '').replaceAll('\\', '/');
118
+ const isApiSourceFile = (filePath)=>external_options_cjs_namespaceObject.API_SOURCE_FILE_PATTERN.test(normalizeFilename(filePath));
119
+ const isForbiddenGeneratedEffectPath = (filePath)=>external_options_cjs_namespaceObject.FORBIDDEN_GENERATED_EFFECT_PATH_PATTERN.test(normalizeFilename(filePath));
120
+ const isApiEntryFile = (filePath)=>external_options_cjs_namespaceObject.API_ENTRY_PATTERN.test(normalizeFilename(filePath));
121
+ const isSharedApiContractFile = (filePath)=>external_options_cjs_namespaceObject.SHARED_API_CONTRACT_PATTERN.test(normalizeFilename(filePath));
122
+ const getCallExpressionName = (node)=>getNodeName(node);
123
+ const reportProgramPattern = (context, node, source, pattern, message)=>{
124
+ if (pattern.test(source)) context.report({
125
+ node,
126
+ message
127
+ });
128
+ };
129
+ const reportMissingProgramPattern = (context, node, source, pattern, message)=>{
130
+ if (!pattern.test(source)) context.report({
131
+ node,
132
+ message
133
+ });
134
+ };
135
+ exports.asStringArray = __webpack_exports__.asStringArray;
136
+ exports.expressionStringValue = __webpack_exports__.expressionStringValue;
137
+ exports.getCallExpressionName = __webpack_exports__.getCallExpressionName;
138
+ exports.getIgnorePattern = __webpack_exports__.getIgnorePattern;
139
+ exports.getLine = __webpack_exports__.getLine;
140
+ exports.getNodeName = __webpack_exports__.getNodeName;
141
+ exports.getSourceText = __webpack_exports__.getSourceText;
142
+ exports.getStringLiteralValue = __webpack_exports__.getStringLiteralValue;
143
+ exports.hasAllowedElementAncestor = __webpack_exports__.hasAllowedElementAncestor;
144
+ exports.hasIgnoreComment = __webpack_exports__.hasIgnoreComment;
145
+ exports.hasLetters = __webpack_exports__.hasLetters;
146
+ exports.isApiEntryFile = __webpack_exports__.isApiEntryFile;
147
+ exports.isApiSourceFile = __webpack_exports__.isApiSourceFile;
148
+ exports.isForbiddenGeneratedEffectPath = __webpack_exports__.isForbiddenGeneratedEffectPath;
149
+ exports.isRecord = __webpack_exports__.isRecord;
150
+ exports.isSharedApiContractFile = __webpack_exports__.isSharedApiContractFile;
151
+ exports.normalizeFilename = __webpack_exports__.normalizeFilename;
152
+ exports.normalizeVisibleText = __webpack_exports__.normalizeVisibleText;
153
+ exports.reportMissingProgramPattern = __webpack_exports__.reportMissingProgramPattern;
154
+ exports.reportProgramPattern = __webpack_exports__.reportProgramPattern;
155
+ exports.reportVisibleText = __webpack_exports__.reportVisibleText;
156
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
157
+ "asStringArray",
158
+ "expressionStringValue",
159
+ "getCallExpressionName",
160
+ "getIgnorePattern",
161
+ "getLine",
162
+ "getNodeName",
163
+ "getSourceText",
164
+ "getStringLiteralValue",
165
+ "hasAllowedElementAncestor",
166
+ "hasIgnoreComment",
167
+ "hasLetters",
168
+ "isApiEntryFile",
169
+ "isApiSourceFile",
170
+ "isForbiddenGeneratedEffectPath",
171
+ "isRecord",
172
+ "isSharedApiContractFile",
173
+ "normalizeFilename",
174
+ "normalizeVisibleText",
175
+ "reportMissingProgramPattern",
176
+ "reportProgramPattern",
177
+ "reportVisibleText"
178
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
179
+ Object.defineProperty(exports, '__esModule', {
180
+ value: true
181
+ });
@@ -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,82 @@
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 expressionVisibleText = (node)=>{
36
+ const text = (0, external_ast_cjs_namespaceObject.expressionStringValue)(node);
37
+ if (void 0 !== text) {
38
+ const visibleText = (0, external_ast_cjs_namespaceObject.normalizeVisibleText)(text);
39
+ return visibleText && (0, external_ast_cjs_namespaceObject.hasLetters)(visibleText) ? text : void 0;
40
+ }
41
+ if (node?.type === 'ConditionalExpression') return expressionVisibleText(node.consequent) ?? expressionVisibleText(node.alternate);
42
+ };
43
+ const createNoHardcodedJsxTextRule = ()=>({
44
+ meta: {
45
+ type: 'problem',
46
+ docs: {
47
+ description: 'Disallow literal user-visible text in JSX children in UltraModern generated apps.'
48
+ },
49
+ schema: [
50
+ external_options_cjs_namespaceObject.commonOptionsSchema
51
+ ]
52
+ },
53
+ create (context) {
54
+ const options = (0, external_options_cjs_namespaceObject.getCommonRuleOption)(context, {
55
+ allowElements: external_options_cjs_namespaceObject.DEFAULT_ALLOWED_ELEMENTS,
56
+ ignoreCommentPattern: external_options_cjs_namespaceObject.DEFAULT_IGNORE_COMMENT_PATTERN
57
+ });
58
+ const allowedElements = new Set(options.allowElements);
59
+ const ignorePattern = (0, external_ast_cjs_namespaceObject.getIgnorePattern)(options);
60
+ const shouldSkipNode = (node)=>(0, external_ast_cjs_namespaceObject.hasAllowedElementAncestor)(node, allowedElements) || (0, external_ast_cjs_namespaceObject.hasIgnoreComment)(node, context, ignorePattern);
61
+ return {
62
+ JSXText (node) {
63
+ const text = (0, external_ast_cjs_namespaceObject.normalizeVisibleText)(String(node.value ?? ''));
64
+ if (!text || !(0, external_ast_cjs_namespaceObject.hasLetters)(text) || shouldSkipNode(node)) return;
65
+ (0, external_ast_cjs_namespaceObject.reportVisibleText)(context, node, text);
66
+ },
67
+ JSXExpressionContainer (node) {
68
+ if (node.parent?.type !== 'JSXElement' && node.parent?.type !== 'JSXFragment') return;
69
+ const text = (0, external_ast_cjs_namespaceObject.normalizeVisibleText)(expressionVisibleText(node.expression) ?? '');
70
+ if (!text || !(0, external_ast_cjs_namespaceObject.hasLetters)(text) || shouldSkipNode(node)) return;
71
+ (0, external_ast_cjs_namespaceObject.reportVisibleText)(context, node, text);
72
+ }
73
+ };
74
+ }
75
+ });
76
+ exports.createNoHardcodedJsxTextRule = __webpack_exports__.createNoHardcodedJsxTextRule;
77
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
78
+ "createNoHardcodedJsxTextRule"
79
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
80
+ Object.defineProperty(exports, '__esModule', {
81
+ value: true
82
+ });
@@ -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
+ });