eslint-plugin-use-agnostic 0.10.2 → 0.10.4
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.
- package/library/_commons/constants/bases.js +6 -3
- package/library/_commons/utilities/helpers.js +30 -23
- package/library/agnostic20/_commons/constants/bases.js +161 -186
- package/library/agnostic20/_commons/utilities/helpers.js +0 -2
- package/library/directive21/_commons/constants/bases.js +195 -274
- package/library/directive21/_commons/utilities/flows.js +3 -0
- package/library/directive21/_commons/utilities/helpers.js +9 -11
- package/library/directive21/config.js +1 -1
- package/package.json +1 -1
|
@@ -78,7 +78,7 @@ export const AGNOSTIC_STRATEGIES_MODULE = "Agnostic Strategies Module";
|
|
|
78
78
|
|
|
79
79
|
// all mappings of "resolved" directives with "resolved" modules
|
|
80
80
|
// agnostic20
|
|
81
|
-
|
|
81
|
+
const effectiveDirectives_effectiveModules = Object.freeze({
|
|
82
82
|
[USE_SERVER_LOGICS]: SERVER_LOGICS_MODULE,
|
|
83
83
|
[USE_SERVER_COMPONENTS]: SERVER_COMPONENTS_MODULE,
|
|
84
84
|
[USE_SERVER_FUNCTIONS]: SERVER_FUNCTIONS_MODULE,
|
|
@@ -88,12 +88,15 @@ export const effectiveDirectives_effectiveModules = Object.freeze({
|
|
|
88
88
|
[USE_AGNOSTIC_COMPONENTS]: AGNOSTIC_COMPONENTS_MODULE,
|
|
89
89
|
});
|
|
90
90
|
// and directive21
|
|
91
|
-
|
|
91
|
+
const commentedDirectives_commentedModules = Object.freeze({
|
|
92
92
|
[USE_CLIENT_CONTEXTS]: CLIENT_CONTEXTS_MODULE,
|
|
93
93
|
[USE_AGNOSTIC_CONDITIONS]: AGNOSTIC_CONDITIONS_MODULE,
|
|
94
94
|
[USE_AGNOSTIC_STRATEGIES]: AGNOSTIC_STRATEGIES_MODULE,
|
|
95
95
|
...effectiveDirectives_effectiveModules,
|
|
96
96
|
});
|
|
97
|
+
// for commons uses
|
|
98
|
+
export const resolvedDirectives_resolvedModules =
|
|
99
|
+
commentedDirectives_commentedModules;
|
|
97
100
|
|
|
98
101
|
// JavaScript/TypeScript extensions
|
|
99
102
|
export const TSX = ".tsx";
|
|
@@ -105,7 +108,7 @@ export const CJS = ".cjs";
|
|
|
105
108
|
|
|
106
109
|
// JavaScript/TypeScript extensions array
|
|
107
110
|
/** @type {Extensions} */
|
|
108
|
-
export const EXTENSIONS = [TSX, TS, JSX, JS, MJS, CJS]; // In priority order
|
|
111
|
+
export const EXTENSIONS = Object.freeze([TSX, TS, JSX, JS, MJS, CJS]); // In priority order
|
|
109
112
|
|
|
110
113
|
// message strings
|
|
111
114
|
export const ARE_NOT_ALLOWED_TO_IMPORT = "are not allowed to import";
|
|
@@ -3,20 +3,26 @@ import path from "path";
|
|
|
3
3
|
|
|
4
4
|
import { loadConfig, createMatchPath } from "tsconfig-paths";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
EXTENSIONS,
|
|
8
|
+
ARE_NOT_ALLOWED_TO_IMPORT,
|
|
9
|
+
resolvedDirectives_resolvedModules,
|
|
10
|
+
} from "../constants/bases.js";
|
|
11
|
+
|
|
12
|
+
import jscommentsConfig from "../../../comments.config.js";
|
|
7
13
|
|
|
8
14
|
/**
|
|
9
|
-
* @typedef {import('../../../types/_commons/typedefs').
|
|
10
|
-
* @typedef {import('../../../types/_commons/typedefs').
|
|
15
|
+
* @typedef {import('../../../types/_commons/typedefs').EffectiveDirective} EffectiveDirective
|
|
16
|
+
* @typedef {import('../../../types/_commons/typedefs').CommentedDirective} CommentedDirective
|
|
17
|
+
* @typedef {import('../../../types/_commons/typedefs').ResolvedDirectiveWithoutUseAgnosticStrategies} ResolvedDirectiveWithoutUseAgnosticStrategies
|
|
18
|
+
* @typedef {import('../../../types/_commons/typedefs').Agnostic20ConfigName} Agnostic20ConfigName
|
|
19
|
+
* @typedef {import('../../../types/_commons/typedefs').Directive21ConfigName} Directive21ConfigName
|
|
20
|
+
* @typedef {import('../../../types/_commons/typedefs').UseAgnosticConfigName} UseAgnosticConfigName
|
|
11
21
|
* @typedef {import('../../../types/_commons/typedefs').Context<string, readonly unknown[]>} Context
|
|
12
22
|
*/
|
|
13
23
|
|
|
14
24
|
/**
|
|
15
|
-
* @template {
|
|
16
|
-
* @typedef {import('../../../types/_commons/typedefs').ImportedFileResolvedDirective<T>} ImportedFileResolvedDirective
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* @template {CurrentFileResolvedDirective} T
|
|
25
|
+
* @template {ResolvedDirectiveWithoutUseAgnosticStrategies} T
|
|
20
26
|
* @typedef {import('../../../types/_commons/typedefs').ResolvedDirectives_BlockedImports<T>} ResolvedDirectives_BlockedImports
|
|
21
27
|
*/
|
|
22
28
|
|
|
@@ -114,10 +120,10 @@ export const highlightFirstLineOfCode = (context) => ({
|
|
|
114
120
|
|
|
115
121
|
/**
|
|
116
122
|
* Returns a boolean deciding if an imported file's "resolved" directive is incompatible with the current file's "resolved" directive.
|
|
117
|
-
* @template {
|
|
123
|
+
* @template {ResolvedDirectiveWithoutUseAgnosticStrategies} T
|
|
118
124
|
* @param {ResolvedDirectives_BlockedImports<T>} resolvedDirectives_blockedImports The blocked imports object, either for agnostic20 or for directive21.
|
|
119
125
|
* @param {T} currentFileResolvedDirective The current file's "resolved" directive.
|
|
120
|
-
* @param {
|
|
126
|
+
* @param {T} importedFileResolvedDirective The imported file's "resolved" directive.
|
|
121
127
|
* @returns `true` if the import is blocked, as established in respective `resolvedDirectives_blockedImports`.
|
|
122
128
|
*/
|
|
123
129
|
export const isImportBlocked = (
|
|
@@ -134,31 +140,32 @@ export const isImportBlocked = (
|
|
|
134
140
|
|
|
135
141
|
/**
|
|
136
142
|
* Makes the intro for each specific import rule violation messages.
|
|
137
|
-
* @template {
|
|
138
|
-
* @
|
|
139
|
-
* @param {
|
|
140
|
-
* @param {
|
|
143
|
+
* @template {ResolvedDirectiveWithoutUseAgnosticStrategies} T
|
|
144
|
+
* @template {ResolvedDirectiveWithoutUseAgnosticStrategies} U
|
|
145
|
+
* @param {T} currentFileResolvedDirective The current file's "resolved" directive, excluding `"use agnostic strategies"`.
|
|
146
|
+
* @param {U} importedFileResolvedDirective The imported file's "resolved" directive, excluding `"use agnostic strategies"`.
|
|
141
147
|
* @returns "[Current file 'resolved' modules] are not allowed to import [imported file 'resolved' modules]."
|
|
142
148
|
*/
|
|
143
149
|
export const makeIntroForSpecificViolationMessage = (
|
|
144
|
-
resolvedDirectives_resolvedModules,
|
|
145
150
|
currentFileResolvedDirective,
|
|
146
151
|
importedFileResolvedDirective
|
|
147
|
-
) =>
|
|
148
|
-
`${resolvedDirectives_resolvedModules[
|
|
152
|
+
) => {
|
|
153
|
+
/** @type {`${typeof resolvedDirectives_resolvedModules[T]}s ${typeof ARE_NOT_ALLOWED_TO_IMPORT} ${typeof resolvedDirectives_resolvedModules[U]}s.`} */
|
|
154
|
+
const introForSpecificViolationMessage = `${resolvedDirectives_resolvedModules[currentFileResolvedDirective]}s ${ARE_NOT_ALLOWED_TO_IMPORT} ${resolvedDirectives_resolvedModules[importedFileResolvedDirective]}s.`;
|
|
155
|
+
|
|
156
|
+
return introForSpecificViolationMessage;
|
|
157
|
+
};
|
|
149
158
|
|
|
150
159
|
/* makeMessageFromCurrentFileResolvedDirective */
|
|
151
160
|
|
|
152
161
|
/**
|
|
153
162
|
* Lists in an message the "resolved" modules incompatible with a "resolved" module based on its "resolved" directive.
|
|
154
|
-
* @template {
|
|
155
|
-
* @param {ResolvedDirectives_ResolvedModules} resolvedDirectives_resolvedModules The resolved modules object, either for agnostic20 or for directive21.
|
|
163
|
+
* @template {ResolvedDirectiveWithoutUseAgnosticStrategies} T
|
|
156
164
|
* @param {ResolvedDirectives_BlockedImports<T>} resolvedDirectives_blockedImports The blocked imports object, either for agnostic20 or for directive21.
|
|
157
165
|
* @param {T} currentFileResolvedDirective The "resolved" directive of the "resolved" module.
|
|
158
166
|
* @returns The message listing the incompatible "resolved" modules.
|
|
159
167
|
*/
|
|
160
168
|
export const makeMessageFromCurrentFileResolvedDirective = (
|
|
161
|
-
resolvedDirectives_resolvedModules,
|
|
162
169
|
resolvedDirectives_blockedImports,
|
|
163
170
|
currentFileResolvedDirective
|
|
164
171
|
) => {
|
|
@@ -193,10 +200,10 @@ export const makeMessageFromCurrentFileResolvedDirective = (
|
|
|
193
200
|
|
|
194
201
|
/**
|
|
195
202
|
* Finds the `message` for the specific violation of "resolved" directives import rules based on `resolvedDirectives_blockedImports`.
|
|
196
|
-
* @template {
|
|
203
|
+
* @template {ResolvedDirectiveWithoutUseAgnosticStrategies} T
|
|
197
204
|
* @param {ResolvedDirectives_BlockedImports<T>} resolvedDirectives_blockedImports The blocked imports object, either for agnostic20 or for directive21.
|
|
198
|
-
* @param {T} currentFileResolvedDirective The current file's "resolved" directive
|
|
199
|
-
* @param {
|
|
205
|
+
* @param {T} currentFileResolvedDirective The current file's "resolved" directive, excluding `"use agnostic strategies"`.
|
|
206
|
+
* @param {T} importedFileResolvedDirective The imported file's "resolved" directive.
|
|
200
207
|
* @returns The corresponding `message`.
|
|
201
208
|
*/
|
|
202
209
|
export const findSpecificViolationMessage = (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
agnostic20ConfigName,
|
|
2
3
|
USE_SERVER_LOGICS as COMMONS_USE_SERVER_LOGICS,
|
|
3
4
|
USE_SERVER_COMPONENTS as COMMONS_USE_SERVER_COMPONENTS,
|
|
4
5
|
USE_SERVER_FUNCTIONS as COMMONS_USE_SERVER_FUNCTIONS,
|
|
@@ -6,10 +7,11 @@ import {
|
|
|
6
7
|
USE_CLIENT_COMPONENTS as COMMONS_USE_CLIENT_COMPONENTS,
|
|
7
8
|
USE_AGNOSTIC_LOGICS as COMMONS_USE_AGNOSTIC_LOGICS,
|
|
8
9
|
USE_AGNOSTIC_COMPONENTS as COMMONS_USE_AGNOSTIC_COMPONENTS,
|
|
9
|
-
effectiveDirectives_effectiveModules,
|
|
10
10
|
} from "../../../_commons/constants/bases.js";
|
|
11
11
|
|
|
12
|
-
import { makeIntroForSpecificViolationMessage
|
|
12
|
+
import { makeIntroForSpecificViolationMessage } from "../../../_commons/utilities/helpers.js";
|
|
13
|
+
|
|
14
|
+
import jscommentsConfig from "../../../../comments.config.js";
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* @typedef {import('../../../../types/agnostic20/_commons/typedefs.js').Directive} Directive
|
|
@@ -26,7 +28,11 @@ export const USE_AGNOSTIC = "use agnostic";
|
|
|
26
28
|
|
|
27
29
|
// directives array
|
|
28
30
|
/** @type {Directives} */
|
|
29
|
-
export const directivesArray = [
|
|
31
|
+
export const directivesArray = Object.freeze([
|
|
32
|
+
USE_SERVER,
|
|
33
|
+
USE_CLIENT,
|
|
34
|
+
USE_AGNOSTIC,
|
|
35
|
+
]);
|
|
30
36
|
|
|
31
37
|
// directives set
|
|
32
38
|
/** @type {ReadonlySet<Directive>} */
|
|
@@ -48,7 +54,7 @@ export const FUNCTIONS = "functions";
|
|
|
48
54
|
|
|
49
55
|
// mapping directives with effective directives
|
|
50
56
|
/** @type {Directives_EffectiveDirectives} */
|
|
51
|
-
export const directives_effectiveDirectives =
|
|
57
|
+
export const directives_effectiveDirectives = {
|
|
52
58
|
[NO_DIRECTIVE]: {
|
|
53
59
|
[LOGICS]: USE_SERVER_LOGICS,
|
|
54
60
|
[COMPONENTS]: USE_SERVER_COMPONENTS,
|
|
@@ -69,7 +75,7 @@ export const directives_effectiveDirectives = Object.freeze({
|
|
|
69
75
|
[COMPONENTS]: USE_AGNOSTIC_COMPONENTS,
|
|
70
76
|
[FUNCTIONS]: null,
|
|
71
77
|
},
|
|
72
|
-
}
|
|
78
|
+
};
|
|
73
79
|
|
|
74
80
|
// message placeholders
|
|
75
81
|
export const currentFileEffectiveDirective = "currentFileEffectiveDirective";
|
|
@@ -79,209 +85,178 @@ export const specificViolationMessage = "specificViolationMessage";
|
|
|
79
85
|
|
|
80
86
|
/* effectiveDirectives_BlockedImports */
|
|
81
87
|
|
|
88
|
+
const SUGGEST_USE_AGNOSTIC =
|
|
89
|
+
"If the module you're trying to import does not possess any server-side code however, please mark it with this plugin's own and eponymous 'use agnostic' directive to signal its compatibility across all environments.";
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Makes a blockedImport object for the identified blocked import at hand.
|
|
93
|
+
* @template {EffectiveDirective} T
|
|
94
|
+
* @template {EffectiveDirective} U
|
|
95
|
+
* @param {T} currentFileEffectiveDirective The current file's effective directive.
|
|
96
|
+
* @param {U} importedFileEffectiveDirective The imported file's effective directive.
|
|
97
|
+
* @returns The blockedImport object for the identified blocked import at hand.
|
|
98
|
+
*/
|
|
99
|
+
export const makeBlockedImport = (
|
|
100
|
+
currentFileEffectiveDirective,
|
|
101
|
+
importedFileEffectiveDirective
|
|
102
|
+
) => {
|
|
103
|
+
return Object.freeze({
|
|
104
|
+
blockedImport: importedFileEffectiveDirective,
|
|
105
|
+
message: `${makeIntroForSpecificViolationMessage(
|
|
106
|
+
currentFileEffectiveDirective,
|
|
107
|
+
importedFileEffectiveDirective
|
|
108
|
+
)} ${
|
|
109
|
+
jscommentsConfig[agnostic20ConfigName][currentFileEffectiveDirective][
|
|
110
|
+
importedFileEffectiveDirective
|
|
111
|
+
]
|
|
112
|
+
}`,
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
82
116
|
/**
|
|
83
|
-
* Makes
|
|
84
|
-
* @
|
|
85
|
-
* @
|
|
86
|
-
* @
|
|
117
|
+
* Makes a blockedImport object for the identified blocked import at hand enhanced with the suggestion to use the `'use agnostic'` directive.
|
|
118
|
+
* @template {EffectiveDirective} T
|
|
119
|
+
* @template {EffectiveDirective} U
|
|
120
|
+
* @param {T} currentFileEffectiveDirective The current file's effective directive.
|
|
121
|
+
* @param {U} importedFileEffectiveDirective The imported file's effective directive.
|
|
122
|
+
* @returns The enhanced blockedImport object with the suggestion to use the `'use agnostic'` directive.
|
|
87
123
|
*/
|
|
88
|
-
const
|
|
124
|
+
const makeBlockedImportSuggestingUseAgnostic = (
|
|
89
125
|
currentFileEffectiveDirective,
|
|
90
126
|
importedFileEffectiveDirective
|
|
91
|
-
) =>
|
|
92
|
-
|
|
93
|
-
effectiveDirectives_effectiveModules,
|
|
127
|
+
) => {
|
|
128
|
+
const blockedImport = makeBlockedImport(
|
|
94
129
|
currentFileEffectiveDirective,
|
|
95
130
|
importedFileEffectiveDirective
|
|
96
131
|
);
|
|
132
|
+
/** @type {`${typeof blockedImport.message} \n${SUGGEST_USE_AGNOSTIC}`} */
|
|
133
|
+
const blockedImportMessageSuggestingUseAgnostic = `${blockedImport.message} \n${SUGGEST_USE_AGNOSTIC}`;
|
|
97
134
|
|
|
98
|
-
|
|
99
|
-
|
|
135
|
+
return Object.freeze({
|
|
136
|
+
...blockedImport,
|
|
137
|
+
message: blockedImportMessageSuggestingUseAgnostic,
|
|
138
|
+
});
|
|
139
|
+
};
|
|
100
140
|
|
|
101
141
|
export const effectiveDirectives_blockedImports = Object.freeze({
|
|
102
142
|
[USE_SERVER_LOGICS]: [
|
|
103
|
-
// USE_SERVER_LOGICS allowed, because
|
|
104
|
-
// USE_SERVER_COMPONENTS allowed, because
|
|
105
|
-
// USE_SERVER_FUNCTIONS allowed, because
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
USE_SERVER_LOGICS,
|
|
117
|
-
USE_CLIENT_COMPONENTS
|
|
118
|
-
)} Client Components cannot be tinkered with on the server.`,
|
|
119
|
-
},
|
|
120
|
-
// USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can run safely on the server just like they can on the client.
|
|
121
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can be composed with Logics on the server just like they can on the client, as long at the Server Logics Module, by convention, does not export React components.
|
|
143
|
+
// USE_SERVER_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_SERVER_LOGICS
|
|
144
|
+
// USE_SERVER_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_SERVER_COMPONENTS
|
|
145
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_SERVER_FUNCTIONS
|
|
146
|
+
makeBlockedImport(
|
|
147
|
+
USE_SERVER_LOGICS,
|
|
148
|
+
USE_CLIENT_LOGICS
|
|
149
|
+
) /* $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_CLIENT_LOGICS */,
|
|
150
|
+
makeBlockedImport(
|
|
151
|
+
USE_SERVER_LOGICS,
|
|
152
|
+
USE_CLIENT_COMPONENTS
|
|
153
|
+
) /* $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_CLIENT_COMPONENTS */,
|
|
154
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_AGNOSTIC_LOGICS
|
|
155
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_LOGICS#USE_AGNOSTIC_COMPONENTS
|
|
122
156
|
],
|
|
123
157
|
[USE_SERVER_COMPONENTS]: [
|
|
124
|
-
// USE_SERVER_LOGICS allowed, because
|
|
125
|
-
// USE_SERVER_COMPONENTS allowed, because
|
|
126
|
-
// USE_SERVER_FUNCTIONS allowed, because
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
// USE_CLIENT_COMPONENTS allowed, because Client Components can be nested inside Server Components either to wrap some of the tree with client state accessible through child Client Components and pass through Server Components, or to create client boundaries when the root of the application is planted on the server.
|
|
135
|
-
// USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can run safely on the server just like they can on the client.
|
|
136
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can render safely on the server just like they can on the client.
|
|
158
|
+
// USE_SERVER_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_SERVER_LOGICS
|
|
159
|
+
// USE_SERVER_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_SERVER_COMPONENTS
|
|
160
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_SERVER_FUNCTIONS
|
|
161
|
+
makeBlockedImport(
|
|
162
|
+
USE_SERVER_COMPONENTS,
|
|
163
|
+
USE_CLIENT_LOGICS
|
|
164
|
+
) /* $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_CLIENT_LOGICS */,
|
|
165
|
+
// USE_CLIENT_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_CLIENT_COMPONENTS
|
|
166
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_AGNOSTIC_LOGICS
|
|
167
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_COMPONENTS#USE_AGNOSTIC_COMPONENTS
|
|
137
168
|
],
|
|
138
169
|
[USE_SERVER_FUNCTIONS]: [
|
|
139
|
-
// USE_SERVER_LOGICS allowed, because
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
USE_SERVER_FUNCTIONS,
|
|
159
|
-
USE_CLIENT_COMPONENTS
|
|
160
|
-
)} Client Components aren't allowed because Server Functions have no business working with React Components.`,
|
|
161
|
-
},
|
|
162
|
-
// USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can run safely on the server just like they can on the client.
|
|
163
|
-
{
|
|
164
|
-
blockedImport: USE_AGNOSTIC_COMPONENTS,
|
|
165
|
-
message: `${makeIntroForSpecificViolationMessage(
|
|
166
|
-
USE_SERVER_FUNCTIONS,
|
|
167
|
-
USE_AGNOSTIC_COMPONENTS
|
|
168
|
-
)} Agnostic Components aren't allowed because Server Functions have no business working with React Components.`,
|
|
169
|
-
},
|
|
170
|
+
// USE_SERVER_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_SERVER_LOGICS
|
|
171
|
+
makeBlockedImport(
|
|
172
|
+
USE_SERVER_FUNCTIONS,
|
|
173
|
+
USE_SERVER_COMPONENTS
|
|
174
|
+
) /* $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_SERVER_COMPONENTS */,
|
|
175
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_SERVER_FUNCTIONS
|
|
176
|
+
makeBlockedImport(
|
|
177
|
+
USE_SERVER_FUNCTIONS,
|
|
178
|
+
USE_CLIENT_LOGICS
|
|
179
|
+
) /* $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_CLIENT_LOGICS */,
|
|
180
|
+
makeBlockedImport(
|
|
181
|
+
USE_SERVER_FUNCTIONS,
|
|
182
|
+
USE_CLIENT_COMPONENTS
|
|
183
|
+
) /* $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_CLIENT_COMPONENTS */,
|
|
184
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_AGNOSTIC_LOGICS
|
|
185
|
+
makeBlockedImport(
|
|
186
|
+
USE_SERVER_FUNCTIONS,
|
|
187
|
+
USE_AGNOSTIC_COMPONENTS
|
|
188
|
+
) /* $COMMENT#AGNOSTIC20#USE_SERVER_FUNCTIONS#USE_AGNOSTIC_COMPONENTS */,
|
|
170
189
|
],
|
|
171
190
|
[USE_CLIENT_LOGICS]: [
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
)} Server Components cannot be thinkered with on the client.
|
|
186
|
-
${SUGGEST_USE_AGNOSTIC}`,
|
|
187
|
-
},
|
|
188
|
-
// USE_SERVER_FUNCTIONS allowed, because Server Functions can technically be attached to Client Components that are being tinkered with within Client Logics Modules.
|
|
189
|
-
// USE_CLIENT_LOGICS allowed, because Client Logics can compose with one another.
|
|
190
|
-
// USE_CLIENT_COMPONENTS allowed, because Client Components are OK to be composed with Client Logics as long as the Client Logics Module, by convention, does not export React components.
|
|
191
|
-
// USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can run safely on the client just like they can on the server.
|
|
192
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can be composed with Logics on the client just like they can on the server, as long as the Client Logics Module, by convention, does not export React components.
|
|
191
|
+
makeBlockedImportSuggestingUseAgnostic(
|
|
192
|
+
USE_CLIENT_LOGICS,
|
|
193
|
+
USE_SERVER_LOGICS
|
|
194
|
+
) /* $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_SERVER_LOGICS */,
|
|
195
|
+
makeBlockedImportSuggestingUseAgnostic(
|
|
196
|
+
USE_CLIENT_LOGICS,
|
|
197
|
+
USE_SERVER_COMPONENTS
|
|
198
|
+
) /* $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_SERVER_COMPONENTS */,
|
|
199
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_SERVER_FUNCTIONS
|
|
200
|
+
// USE_CLIENT_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_CLIENT_LOGICS
|
|
201
|
+
// USE_CLIENT_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_CLIENT_COMPONENTS
|
|
202
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_AGNOSTIC_LOGICS
|
|
203
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_AGNOSTIC_COMPONENTS
|
|
193
204
|
],
|
|
194
205
|
[USE_CLIENT_COMPONENTS]: [
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
)} Server Components may only pass through Client Components via the children prop within Server Components Modules.
|
|
209
|
-
${SUGGEST_USE_AGNOSTIC}`,
|
|
210
|
-
},
|
|
211
|
-
// USE_SERVER_FUNCTIONS allowed, because Server Functions are specifically triggered by Client Components.
|
|
212
|
-
// USE_CLIENT_LOGICS allowed, because Client Logics, being logic from the client, can safely support Client Components.
|
|
213
|
-
// USE_CLIENT_COMPONENTS allowed, because Client Components can compose with one another.
|
|
214
|
-
// USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can run safely on the client just like they can on the server.
|
|
215
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can render safely on the client just like they can on the server.
|
|
206
|
+
makeBlockedImportSuggestingUseAgnostic(
|
|
207
|
+
USE_CLIENT_LOGICS,
|
|
208
|
+
USE_SERVER_LOGICS
|
|
209
|
+
) /* $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_SERVER_LOGICS */,
|
|
210
|
+
makeBlockedImportSuggestingUseAgnostic(
|
|
211
|
+
USE_CLIENT_LOGICS,
|
|
212
|
+
USE_SERVER_COMPONENTS
|
|
213
|
+
) /* $COMMENT#AGNOSTIC20#USE_CLIENT_LOGICS#USE_SERVER_COMPONENTS */,
|
|
214
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#AGNOSTIC20#USE_CLIENT_COMPONENTS#USE_SERVER_FUNCTIONS
|
|
215
|
+
// USE_CLIENT_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_CLIENT_COMPONENTS#USE_CLIENT_LOGICS
|
|
216
|
+
// USE_CLIENT_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_CLIENT_COMPONENTS#USE_CLIENT_COMPONENTS
|
|
217
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_CLIENT_COMPONENTS#USE_AGNOSTIC_LOGICS
|
|
218
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_CLIENT_COMPONENTS#USE_AGNOSTIC_COMPONENTS
|
|
216
219
|
],
|
|
217
220
|
[USE_AGNOSTIC_LOGICS]: [
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
blockedImport: USE_CLIENT_LOGICS,
|
|
243
|
-
message: `${makeIntroForSpecificViolationMessage(
|
|
244
|
-
USE_AGNOSTIC_LOGICS,
|
|
245
|
-
USE_CLIENT_LOGICS
|
|
246
|
-
)} Client Logics cannot run on both the server and the client.`,
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
blockedImport: USE_CLIENT_COMPONENTS,
|
|
250
|
-
message: `${makeIntroForSpecificViolationMessage(
|
|
251
|
-
USE_AGNOSTIC_LOGICS,
|
|
252
|
-
USE_CLIENT_COMPONENTS
|
|
253
|
-
)} Client Components cannot be tinkered with on both the server and the client.`,
|
|
254
|
-
},
|
|
255
|
-
// USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics can compose with one another.
|
|
256
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can be composed with Logics agnostically as long as the Agnostic Logics Module, by convention, does not export React components.
|
|
221
|
+
makeBlockedImportSuggestingUseAgnostic(
|
|
222
|
+
USE_AGNOSTIC_LOGICS,
|
|
223
|
+
USE_SERVER_LOGICS
|
|
224
|
+
) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_SERVER_LOGICS */,
|
|
225
|
+
makeBlockedImportSuggestingUseAgnostic(
|
|
226
|
+
USE_AGNOSTIC_LOGICS,
|
|
227
|
+
USE_SERVER_COMPONENTS
|
|
228
|
+
) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_SERVER_COMPONENTS */,
|
|
229
|
+
makeBlockedImport(
|
|
230
|
+
USE_AGNOSTIC_LOGICS,
|
|
231
|
+
USE_SERVER_FUNCTIONS
|
|
232
|
+
) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_SERVER_FUNCTIONS */,
|
|
233
|
+
makeBlockedImport(
|
|
234
|
+
USE_AGNOSTIC_LOGICS,
|
|
235
|
+
USE_CLIENT_LOGICS
|
|
236
|
+
) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_CLIENT_LOGICS */,
|
|
237
|
+
makeBlockedImport(
|
|
238
|
+
USE_AGNOSTIC_LOGICS,
|
|
239
|
+
USE_CLIENT_COMPONENTS
|
|
240
|
+
) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_CLIENT_COMPONENTS */,
|
|
241
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_AGNOSTIC_LOGICS
|
|
242
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_AGNOSTIC_LOGICS#USE_AGNOSTIC_COMPONENTS
|
|
257
243
|
],
|
|
258
244
|
[USE_AGNOSTIC_COMPONENTS]: [
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
$
|
|
274
|
-
|
|
275
|
-
// USE_SERVER_FUNCTIONS allowed, because Server Functions can be passed to Client Components as props when Client Components are also legally imported into Agnostic Components Modules.
|
|
276
|
-
{
|
|
277
|
-
blockedImport: USE_CLIENT_LOGICS,
|
|
278
|
-
message: `${makeIntroForSpecificViolationMessage(
|
|
279
|
-
USE_AGNOSTIC_COMPONENTS,
|
|
280
|
-
USE_CLIENT_LOGICS
|
|
281
|
-
)} Client Logics cannot run on both the server and the client.`,
|
|
282
|
-
},
|
|
283
|
-
// USE_CLIENT_COMPONENTS allowed, because Client Components can be nested inside Agnostic Components either to wrap some of the tree with client state accessible through child Client Components and pass through Server Components (if still on the Server Tree), or to create client boundaries when the root of the application is planted on the server.
|
|
284
|
-
// USE_AGNOSTIC_LOGICS allowed, because Agnostic Logics, being environment-agnostic logic, can safely support Agnostic Components.
|
|
285
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Agnostic Components can compose with one another.
|
|
245
|
+
makeBlockedImportSuggestingUseAgnostic(
|
|
246
|
+
USE_AGNOSTIC_COMPONENTS,
|
|
247
|
+
USE_SERVER_LOGICS
|
|
248
|
+
) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_SERVER_LOGICS */,
|
|
249
|
+
makeBlockedImportSuggestingUseAgnostic(
|
|
250
|
+
USE_AGNOSTIC_COMPONENTS,
|
|
251
|
+
USE_SERVER_COMPONENTS
|
|
252
|
+
) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_SERVER_COMPONENTS */,
|
|
253
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_SERVER_FUNCTIONS
|
|
254
|
+
makeBlockedImport(
|
|
255
|
+
USE_AGNOSTIC_COMPONENTS,
|
|
256
|
+
USE_CLIENT_LOGICS
|
|
257
|
+
) /* $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_CLIENT_LOGICS */,
|
|
258
|
+
// USE_CLIENT_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_CLIENT_COMPONENTS
|
|
259
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_AGNOSTIC_LOGICS
|
|
260
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#AGNOSTIC20#USE_AGNOSTIC_COMPONENTS#USE_AGNOSTIC_COMPONENTS
|
|
286
261
|
],
|
|
287
262
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { effectiveDirectives_effectiveModules } from "../../../_commons/constants/bases.js";
|
|
2
1
|
import {
|
|
3
2
|
USE_SERVER,
|
|
4
3
|
LOGICS,
|
|
@@ -145,7 +144,6 @@ export const makeMessageFromCurrentFileEffectiveDirective = (
|
|
|
145
144
|
effectiveDirective
|
|
146
145
|
) =>
|
|
147
146
|
makeMessageFromCurrentFileResolvedDirective(
|
|
148
|
-
effectiveDirectives_effectiveModules,
|
|
149
147
|
effectiveDirectives_blockedImports,
|
|
150
148
|
effectiveDirective
|
|
151
149
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
directive21ConfigName,
|
|
2
3
|
USE_SERVER_LOGICS as COMMONS_USE_SERVER_LOGICS,
|
|
3
4
|
USE_CLIENT_LOGICS as COMMONS_USE_CLIENT_LOGICS,
|
|
4
5
|
USE_AGNOSTIC_LOGICS as COMMONS_USE_AGNOSTIC_LOGICS,
|
|
@@ -9,11 +10,12 @@ import {
|
|
|
9
10
|
USE_CLIENT_CONTEXTS as COMMONS_USE_CLIENT_CONTEXTS,
|
|
10
11
|
USE_AGNOSTIC_CONDITIONS as COMMONS_USE_AGNOSTIC_CONDITIONS,
|
|
11
12
|
USE_AGNOSTIC_STRATEGIES as COMMONS_USE_AGNOSTIC_STRATEGIES,
|
|
12
|
-
commentedDirectives_commentedModules,
|
|
13
13
|
} from "../../../_commons/constants/bases.js";
|
|
14
14
|
|
|
15
15
|
import { makeIntroForSpecificViolationMessage as commonsMakeIntroForSpecificViolationMessage } from "../../../_commons/utilities/helpers.js";
|
|
16
16
|
|
|
17
|
+
import jscommentsConfig from "../../../../comments.config.js";
|
|
18
|
+
|
|
17
19
|
/**
|
|
18
20
|
* @typedef {import('../../../../types/directive21/_commons/typedefs.js').CommentedDirective} CommentedDirective
|
|
19
21
|
* @typedef {import('../../../../types/directive21/_commons/typedefs.js').CommentedDirectiveWithoutUseAgnosticStrategies} CommentedDirectiveWithoutUseAgnosticStrategies
|
|
@@ -36,7 +38,7 @@ export const USE_AGNOSTIC_STRATEGIES = COMMONS_USE_AGNOSTIC_STRATEGIES;
|
|
|
36
38
|
|
|
37
39
|
// commented directives array
|
|
38
40
|
/** @type {CommentedDirectives} */
|
|
39
|
-
export const commentedDirectivesArray = [
|
|
41
|
+
export const commentedDirectivesArray = Object.freeze([
|
|
40
42
|
USE_SERVER_LOGICS,
|
|
41
43
|
USE_CLIENT_LOGICS,
|
|
42
44
|
USE_AGNOSTIC_LOGICS,
|
|
@@ -47,7 +49,7 @@ export const commentedDirectivesArray = [
|
|
|
47
49
|
USE_CLIENT_CONTEXTS,
|
|
48
50
|
USE_AGNOSTIC_CONDITIONS,
|
|
49
51
|
USE_AGNOSTIC_STRATEGIES,
|
|
50
|
-
];
|
|
52
|
+
]);
|
|
51
53
|
|
|
52
54
|
// commented directives set
|
|
53
55
|
/** @type {ReadonlySet<CommentedDirective>} */
|
|
@@ -80,7 +82,7 @@ export const AT_AGNOSTIC_CONDITIONS = "@agnosticConditions";
|
|
|
80
82
|
|
|
81
83
|
// commented strategies array
|
|
82
84
|
/** @type {CommentedStrategies} */
|
|
83
|
-
export const strategiesArray = [
|
|
85
|
+
export const strategiesArray = Object.freeze([
|
|
84
86
|
AT_SERVER_LOGICS,
|
|
85
87
|
AT_CLIENT_LOGICS,
|
|
86
88
|
AT_AGNOSTIC_LOGICS,
|
|
@@ -90,7 +92,7 @@ export const strategiesArray = [
|
|
|
90
92
|
AT_SERVER_FUNCTIONS,
|
|
91
93
|
AT_CLIENT_CONTEXTS,
|
|
92
94
|
AT_AGNOSTIC_CONDITIONS,
|
|
93
|
-
];
|
|
95
|
+
]);
|
|
94
96
|
|
|
95
97
|
// commented strategies set
|
|
96
98
|
/** @type {ReadonlySet<CommentedStrategy>} */
|
|
@@ -174,296 +176,215 @@ export const commentedDirectives_verificationReports = Object.freeze({
|
|
|
174
176
|
/* commentedDirectives_blockedImports */
|
|
175
177
|
|
|
176
178
|
/**
|
|
177
|
-
* Makes
|
|
178
|
-
* @
|
|
179
|
-
* @
|
|
180
|
-
* @
|
|
179
|
+
* Makes a blockedImport object for the identified blocked import at hand.
|
|
180
|
+
* @template {CommentedDirectiveWithoutUseAgnosticStrategies} T
|
|
181
|
+
* @template {CommentedDirectiveWithoutUseAgnosticStrategies} U
|
|
182
|
+
* @param {T} currentFileCommentedDirective The current file's commented directive.
|
|
183
|
+
* @param {U} importedFileCommentedDirective The imported file's commented directive.
|
|
184
|
+
* @returns The blockedImport object for the identified blocked import at hand.
|
|
181
185
|
*/
|
|
182
|
-
const
|
|
186
|
+
export const makeBlockedImport = (
|
|
183
187
|
currentFileCommentedDirective,
|
|
184
188
|
importedFileCommentedDirective
|
|
185
|
-
) =>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
) => {
|
|
190
|
+
return Object.freeze({
|
|
191
|
+
blockedImport: importedFileCommentedDirective,
|
|
192
|
+
message: `${commonsMakeIntroForSpecificViolationMessage(
|
|
193
|
+
currentFileCommentedDirective,
|
|
194
|
+
importedFileCommentedDirective
|
|
195
|
+
)} ${
|
|
196
|
+
jscommentsConfig[directive21ConfigName][currentFileCommentedDirective][
|
|
197
|
+
importedFileCommentedDirective
|
|
198
|
+
]
|
|
199
|
+
}`,
|
|
200
|
+
});
|
|
201
|
+
};
|
|
191
202
|
|
|
192
203
|
export const commentedDirectives_blockedImports = Object.freeze({
|
|
193
204
|
[USE_SERVER_LOGICS]: [
|
|
194
|
-
// USE_SERVER_LOGICS allowed, because
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
//
|
|
212
|
-
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions, being able to import one another, can compose and do so via Prime Server Logics, despite this method seeming superfluous at first glance. (Perhaps a preferrable use case for this has been found or could be found either today or in the future.)
|
|
213
|
-
{
|
|
214
|
-
blockedImport: USE_CLIENT_CONTEXTS,
|
|
215
|
-
message: `${makeIntroForSpecificViolationMessage(
|
|
216
|
-
USE_SERVER_LOGICS,
|
|
217
|
-
USE_CLIENT_CONTEXTS
|
|
218
|
-
)} (Special) Client Contexts Components, like any Client Components, cannot be tinkered with on the server.`,
|
|
219
|
-
},
|
|
220
|
-
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components are able to safely render on the server, guaranteeing that only their `ComponentForServer` will be effectively involved in Prime Server Logics Modules.
|
|
205
|
+
// USE_SERVER_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_LOGICS#USE_SERVER_LOGICS
|
|
206
|
+
makeBlockedImport(
|
|
207
|
+
USE_SERVER_LOGICS,
|
|
208
|
+
USE_CLIENT_LOGICS
|
|
209
|
+
) /* $COMMENT#DIRECTIVE21#USE_SERVER_LOGICS#USE_CLIENT_LOGICS */,
|
|
210
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_LOGICS#USE_AGNOSTIC_LOGICS
|
|
211
|
+
// USE_SERVER_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_LOGICS#USE_SERVER_COMPONENTS
|
|
212
|
+
makeBlockedImport(
|
|
213
|
+
USE_SERVER_LOGICS,
|
|
214
|
+
USE_CLIENT_COMPONENTS
|
|
215
|
+
) /* $COMMENT#DIRECTIVE21#USE_SERVER_LOGICS#USE_CLIENT_COMPONENTS */,
|
|
216
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_LOGICS#USE_AGNOSTIC_COMPONENTS
|
|
217
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_LOGICS#USE_SERVER_FUNCTIONS
|
|
218
|
+
makeBlockedImport(
|
|
219
|
+
USE_SERVER_LOGICS,
|
|
220
|
+
USE_CLIENT_CONTEXTS
|
|
221
|
+
) /* $COMMENT#DIRECTIVE21#USE_SERVER_LOGICS#USE_CLIENT_CONTEXTS */,
|
|
222
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_LOGICS#USE_AGNOSTIC_CONDITIONS
|
|
221
223
|
],
|
|
222
224
|
[USE_CLIENT_LOGICS]: [
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
// USE_CLIENT_COMPONENTS allowed, because Lineal Client Components, like any Client Components, are OK to be composed with Prime Client Logics as long as the Prime Client Logics Module, by convention, does not export React components.
|
|
240
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can be composed with any Prime Environment Logics agnostically as long as the Prime Environment Logics Module, by convention, does not export React components.
|
|
241
|
-
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions can technically be attached to Client Components that are being tinkered with within Client Logics Modules.
|
|
242
|
-
// USE_CLIENT_CONTEXTS allowed, because (Special) Client Contexts Components, like any Client Components, are OK to be composed with Prime Client Logics as long as the Prime Client Logics Module, by convention, does not export React components.
|
|
243
|
-
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components are able to safely render on the client, guaranteeing that only their `ComponentForClient` will be effectively involved in Prime Client Logics Modules.
|
|
225
|
+
makeBlockedImport(
|
|
226
|
+
USE_CLIENT_LOGICS,
|
|
227
|
+
USE_SERVER_LOGICS
|
|
228
|
+
) /* $COMMENT#DIRECTIVE21#USE_CLIENT_LOGICS#USE_SERVER_LOGICS */,
|
|
229
|
+
// USE_CLIENT_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_LOGICS#USE_CLIENT_LOGICS
|
|
230
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_LOGICS#USE_AGNOSTIC_LOGICS
|
|
231
|
+
makeBlockedImport(
|
|
232
|
+
USE_CLIENT_LOGICS,
|
|
233
|
+
USE_SERVER_COMPONENTS
|
|
234
|
+
) /* $COMMENT#DIRECTIVE21#USE_CLIENT_LOGICS#USE_SERVER_COMPONENTS */,
|
|
235
|
+
// USE_CLIENT_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_LOGICS#USE_CLIENT_COMPONENTS
|
|
236
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_LOGICS#USE_AGNOSTIC_COMPONENTS
|
|
237
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_LOGICS#USE_SERVER_FUNCTIONS
|
|
238
|
+
// USE_CLIENT_CONTEXTS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_LOGICS#USE_CLIENT_CONTEXTS
|
|
239
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_LOGICS#USE_AGNOSTIC_CONDITIONS
|
|
244
240
|
],
|
|
245
241
|
[USE_AGNOSTIC_LOGICS]: [
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
)} Lineal Client Components, like any Client Components, cannot be tinkered with on both the server and the client.`,
|
|
274
|
-
},
|
|
275
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can be composed with any Prime Environment Logics agnostically as long as the Prime Environment Logics Module, by convention, does not export React components.
|
|
276
|
-
{
|
|
277
|
-
blockedImport: USE_SERVER_FUNCTIONS,
|
|
278
|
-
message: `${makeIntroForSpecificViolationMessage(
|
|
279
|
-
USE_AGNOSTIC_LOGICS,
|
|
280
|
-
USE_SERVER_FUNCTIONS
|
|
281
|
-
)} (Special) Server Functions can be modified on the server and on the client, but their use cases on both environments are not one-to-one compatible, since they're being addressed as they are on the server and addressed as references on the client.`,
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
blockedImport: USE_CLIENT_CONTEXTS,
|
|
285
|
-
message: `${makeIntroForSpecificViolationMessage(
|
|
286
|
-
USE_AGNOSTIC_LOGICS,
|
|
287
|
-
USE_CLIENT_CONTEXTS
|
|
288
|
-
)} (Special) Client Contexts Components, like any Client Components, cannot be tinkered with on both the server and the client.`,
|
|
289
|
-
},
|
|
290
|
-
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components, as if they were Lineal Agnostic Components themselves, can be composed with any Prime Environment Logics agnostically as long as the Prime Environment Logics Module, by convention, does not export React components.
|
|
242
|
+
makeBlockedImport(
|
|
243
|
+
USE_AGNOSTIC_LOGICS,
|
|
244
|
+
USE_SERVER_LOGICS
|
|
245
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_LOGICS#USE_SERVER_LOGICS */,
|
|
246
|
+
makeBlockedImport(
|
|
247
|
+
USE_AGNOSTIC_LOGICS,
|
|
248
|
+
USE_CLIENT_LOGICS
|
|
249
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_LOGICS#USE_CLIENT_LOGICS */,
|
|
250
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_LOGICS#USE_AGNOSTIC_LOGICS
|
|
251
|
+
makeBlockedImport(
|
|
252
|
+
USE_AGNOSTIC_LOGICS,
|
|
253
|
+
USE_SERVER_COMPONENTS
|
|
254
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_LOGICS#USE_SERVER_COMPONENTS */,
|
|
255
|
+
makeBlockedImport(
|
|
256
|
+
USE_AGNOSTIC_LOGICS,
|
|
257
|
+
USE_CLIENT_COMPONENTS
|
|
258
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_LOGICS#USE_CLIENT_COMPONENTS */,
|
|
259
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_LOGICS#USE_AGNOSTIC_COMPONENTS
|
|
260
|
+
makeBlockedImport(
|
|
261
|
+
USE_AGNOSTIC_LOGICS,
|
|
262
|
+
USE_SERVER_FUNCTIONS
|
|
263
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_LOGICS#USE_SERVER_FUNCTIONS */,
|
|
264
|
+
makeBlockedImport(
|
|
265
|
+
USE_AGNOSTIC_LOGICS,
|
|
266
|
+
USE_CLIENT_CONTEXTS
|
|
267
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_LOGICS#USE_CLIENT_CONTEXTS */,
|
|
268
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_LOGICS#USE_AGNOSTIC_CONDITIONS
|
|
291
269
|
],
|
|
292
270
|
[USE_SERVER_COMPONENTS]: [
|
|
293
|
-
// USE_SERVER_LOGICS allowed, because
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
//
|
|
302
|
-
//
|
|
303
|
-
//
|
|
304
|
-
//
|
|
305
|
-
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions can be passed to imported Client Components within Lineal Server Components Modules, even though indeed Lineal Server Components Modules and Lineal Server Components can make their own Server Functions through inline 'use server' directives.
|
|
306
|
-
// USE_CLIENT_CONTEXTS allowed, because (Special) Client Contexts Components can be nested inside Server Components to wrap some of the tree with client state accessible through child Client Components, and to pass through Server Components when the root of the application is planted on the server.
|
|
307
|
-
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components, as if they were Lineal Agnostic Components themselves, can render safely on the server just like they can on the client.
|
|
271
|
+
// USE_SERVER_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_COMPONENTS#USE_SERVER_LOGICS
|
|
272
|
+
makeBlockedImport(
|
|
273
|
+
USE_SERVER_COMPONENTS,
|
|
274
|
+
USE_CLIENT_LOGICS
|
|
275
|
+
) /* $COMMENT#DIRECTIVE21#USE_SERVER_COMPONENTS#USE_CLIENT_LOGICS */,
|
|
276
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_COMPONENTS#USE_AGNOSTIC_LOGICS
|
|
277
|
+
// USE_SERVER_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_COMPONENTS#USE_SERVER_COMPONENTS
|
|
278
|
+
// USE_CLIENT_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_COMPONENTS#USE_CLIENT_COMPONENTS
|
|
279
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_COMPONENTS#USE_AGNOSTIC_COMPONENTS
|
|
280
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_COMPONENTS#USE_SERVER_FUNCTIONS
|
|
281
|
+
// USE_CLIENT_CONTEXTS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_COMPONENTS#USE_CLIENT_CONTEXTS
|
|
282
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_COMPONENTS#USE_AGNOSTIC_CONDITIONS
|
|
308
283
|
],
|
|
309
284
|
[USE_CLIENT_COMPONENTS]: [
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
},
|
|
326
|
-
// USE_CLIENT_COMPONENTS allowed, because Lineal Client Components can compose with one another.
|
|
327
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can render safely on the client just like they can on the server.
|
|
328
|
-
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions are specifically triggered by Client Components.
|
|
329
|
-
// USE_CLIENT_CONTEXTS allowed, because (Special) Client Contexts Components can effectively become Lineal and only render their children on the client via this mechanism since, by a Client Contexts Component being the child of a Lineal Client Component, the Client Contexts Component's children become the grand-children of an ancestor Lineal Client Component, enforcing them to render exclusively on the client.
|
|
330
|
-
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components, as if they were Lineal Agnostic Components themselves, can render safely on the client just like they can on the server.
|
|
285
|
+
makeBlockedImport(
|
|
286
|
+
USE_CLIENT_COMPONENTS,
|
|
287
|
+
USE_SERVER_LOGICS
|
|
288
|
+
) /* $COMMENT#DIRECTIVE21#USE_CLIENT_COMPONENTS#USE_SERVER_LOGICS */,
|
|
289
|
+
// USE_CLIENT_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_COMPONENTS#USE_CLIENT_LOGICS
|
|
290
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_COMPONENTS#USE_AGNOSTIC_LOGICS
|
|
291
|
+
makeBlockedImport(
|
|
292
|
+
USE_CLIENT_COMPONENTS,
|
|
293
|
+
USE_SERVER_COMPONENTS
|
|
294
|
+
) /* $COMMENT#DIRECTIVE21#USE_CLIENT_COMPONENTS#USE_SERVER_COMPONENTS */,
|
|
295
|
+
// USE_CLIENT_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_COMPONENTS#USE_CLIENT_COMPONENTS
|
|
296
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_COMPONENTS#USE_AGNOSTIC_COMPONENTS
|
|
297
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_COMPONENTS#USE_SERVER_FUNCTIONS
|
|
298
|
+
// USE_CLIENT_CONTEXTS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_COMPONENTS#USE_CLIENT_CONTEXTS
|
|
299
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_COMPONENTS#USE_AGNOSTIC_CONDITIONS
|
|
331
300
|
],
|
|
332
301
|
[USE_AGNOSTIC_COMPONENTS]: [
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
//
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
USE_AGNOSTIC_COMPONENTS,
|
|
352
|
-
USE_SERVER_COMPONENTS
|
|
353
|
-
)} Lineal Server Components, unlike Lineal Client Components, cannot make silos of their own once on the opposing environment (the client in this case), and therefore cannot be executed from the client, making them unable to execute agnostically from both the server and the client.`,
|
|
354
|
-
},
|
|
355
|
-
// USE_CLIENT_COMPONENTS allowed, because Lineal Client Components can be nested inside Agnostic Components to create client boundaries when the root of the application is planted on the server.
|
|
356
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components, can compose with one another.
|
|
357
|
-
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions can be passed to Client Components as props when Client Components are also legally imported into Agnostic Components Modules.
|
|
358
|
-
// USE_CLIENT_CONTEXTS allowed, because (Special) Client Contexts Components can be nested inside Agnostic Components to wrap some of the tree with client state accessible through child Client Components, and to pass through Server Components (if still on the Server Tree) when the root of the application is planted on the server.
|
|
359
|
-
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components can compose with Lineal Agnostic Components as if they were Lineal Agnostic Components themselves, making them a necessary mechanism for Server Components to be nested in Agnostic Components.
|
|
302
|
+
makeBlockedImport(
|
|
303
|
+
USE_AGNOSTIC_COMPONENTS,
|
|
304
|
+
USE_SERVER_LOGICS
|
|
305
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_COMPONENTS#USE_SERVER_LOGICS */,
|
|
306
|
+
makeBlockedImport(
|
|
307
|
+
USE_AGNOSTIC_COMPONENTS,
|
|
308
|
+
USE_CLIENT_LOGICS
|
|
309
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_COMPONENTS#USE_CLIENT_LOGICS */,
|
|
310
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_COMPONENTS#USE_AGNOSTIC_LOGICS
|
|
311
|
+
makeBlockedImport(
|
|
312
|
+
USE_AGNOSTIC_COMPONENTS,
|
|
313
|
+
USE_SERVER_COMPONENTS
|
|
314
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_COMPONENTS#USE_SERVER_COMPONENTS */,
|
|
315
|
+
// USE_CLIENT_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_COMPONENTS#USE_CLIENT_COMPONENTS
|
|
316
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_COMPONENTS#USE_AGNOSTIC_COMPONENTS
|
|
317
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_COMPONENTS#USE_SERVER_FUNCTIONS
|
|
318
|
+
// USE_CLIENT_CONTEXTS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_COMPONENTS#USE_CLIENT_CONTEXTS
|
|
319
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_COMPONENTS#USE_AGNOSTIC_CONDITIONS
|
|
360
320
|
],
|
|
361
321
|
[USE_SERVER_FUNCTIONS]: [
|
|
362
|
-
// USE_SERVER_LOGICS allowed, because
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
USE_AGNOSTIC_COMPONENTS
|
|
390
|
-
)} Lineal Agnostic Components aren't allowed because (Special) Server Functions have no business working with React Components.`,
|
|
391
|
-
},
|
|
392
|
-
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions, even though they don't need to import one another and the same results can be generated via Prime Server Logics for the outcome of a single Server Function, can still compose with one another. (Perhaps a preferrable use case for this has been found or could be found either today or in the future.)
|
|
393
|
-
{
|
|
394
|
-
blockedImport: USE_CLIENT_CONTEXTS,
|
|
395
|
-
message: `${makeIntroForSpecificViolationMessage(
|
|
396
|
-
USE_SERVER_FUNCTIONS,
|
|
397
|
-
USE_CLIENT_CONTEXTS
|
|
398
|
-
)} (Special) Client Contexts Components aren't allowed because (Special) Server Functions have no business working with React Components.`,
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
blockedImport: USE_AGNOSTIC_CONDITIONS,
|
|
402
|
-
message: `${makeIntroForSpecificViolationMessage(
|
|
403
|
-
USE_SERVER_FUNCTIONS,
|
|
404
|
-
USE_AGNOSTIC_CONDITIONS
|
|
405
|
-
)} (Special) Agnostic Conditions Components aren't allowed because (Special) Server Functions have no business working with React Components.`,
|
|
406
|
-
},
|
|
322
|
+
// USE_SERVER_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_FUNCTIONS#USE_SERVER_LOGICS
|
|
323
|
+
makeBlockedImport(
|
|
324
|
+
USE_SERVER_FUNCTIONS,
|
|
325
|
+
USE_CLIENT_LOGICS
|
|
326
|
+
) /* $COMMENT#DIRECTIVE21#USE_SERVER_FUNCTIONS#USE_CLIENT_LOGICS */,
|
|
327
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_FUNCTIONS#USE_AGNOSTIC_LOGICS
|
|
328
|
+
makeBlockedImport(
|
|
329
|
+
USE_SERVER_FUNCTIONS,
|
|
330
|
+
USE_SERVER_COMPONENTS
|
|
331
|
+
) /* $COMMENT#DIRECTIVE21#USE_SERVER_FUNCTIONS#USE_SERVER_COMPONENTS */,
|
|
332
|
+
makeBlockedImport(
|
|
333
|
+
USE_SERVER_FUNCTIONS,
|
|
334
|
+
USE_CLIENT_COMPONENTS
|
|
335
|
+
) /* $COMMENT#DIRECTIVE21#USE_SERVER_FUNCTIONS#USE_CLIENT_COMPONENTS */,
|
|
336
|
+
makeBlockedImport(
|
|
337
|
+
USE_SERVER_FUNCTIONS,
|
|
338
|
+
USE_AGNOSTIC_COMPONENTS
|
|
339
|
+
) /* $COMMENT#DIRECTIVE21#USE_SERVER_FUNCTIONS#USE_AGNOSTIC_COMPONENTS */,
|
|
340
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#DIRECTIVE21#USE_SERVER_FUNCTIONS#USE_SERVER_FUNCTIONS
|
|
341
|
+
makeBlockedImport(
|
|
342
|
+
USE_SERVER_FUNCTIONS,
|
|
343
|
+
USE_CLIENT_CONTEXTS
|
|
344
|
+
) /* $COMMENT#DIRECTIVE21#USE_SERVER_FUNCTIONS#USE_CLIENT_CONTEXTS */,
|
|
345
|
+
makeBlockedImport(
|
|
346
|
+
USE_SERVER_FUNCTIONS,
|
|
347
|
+
USE_AGNOSTIC_CONDITIONS
|
|
348
|
+
) /* $COMMENT#DIRECTIVE21#USE_SERVER_FUNCTIONS#USE_AGNOSTIC_CONDITIONS */,
|
|
407
349
|
],
|
|
408
350
|
[USE_CLIENT_CONTEXTS]: [
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
},
|
|
425
|
-
// USE_CLIENT_COMPONENTS allowed, because Lineal Client Components can create client boundaries within (Special) Client Contexts Components.
|
|
426
|
-
// USE_AGNOSTIC_COMPONENTS allowed, because Lineal Agnostic Components can render safely on the client just like they can on the server.
|
|
427
|
-
// USE_SERVER_FUNCTIONS allowed, because (Special) Server Functions are specifically triggered by Client Components.
|
|
428
|
-
// USE_CLIENT_CONTEXTS allowed, because (Special) Client Contexts Components can compose with one another.
|
|
429
|
-
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components, as if they were Lineal Agnostic Components themselves, can render safely on the client just like they can on the server, in a mechanism that allows (Special) Client Contexts Components to safely and indirectly compose with child Server Components within Client Contexts Modules.
|
|
351
|
+
makeBlockedImport(
|
|
352
|
+
USE_CLIENT_CONTEXTS,
|
|
353
|
+
USE_SERVER_LOGICS
|
|
354
|
+
) /* $COMMENT#DIRECTIVE21#USE_CLIENT_CONTEXTS#USE_SERVER_LOGICS */,
|
|
355
|
+
// USE_CLIENT_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_CONTEXTS#USE_CLIENT_LOGICS
|
|
356
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_CONTEXTS#USE_AGNOSTIC_LOGICS
|
|
357
|
+
makeBlockedImport(
|
|
358
|
+
USE_CLIENT_CONTEXTS,
|
|
359
|
+
USE_SERVER_COMPONENTS
|
|
360
|
+
) /* $COMMENT#DIRECTIVE21#USE_CLIENT_CONTEXTS#USE_SERVER_COMPONENTS */,
|
|
361
|
+
// USE_CLIENT_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_CONTEXTS#USE_CLIENT_COMPONENTS
|
|
362
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_CONTEXTS#USE_AGNOSTIC_COMPONENTS
|
|
363
|
+
// USE_SERVER_FUNCTIONS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_CONTEXTS#USE_SERVER_FUNCTIONS
|
|
364
|
+
// USE_CLIENT_CONTEXTS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_CONTEXTS#USE_CLIENT_CONTEXTS
|
|
365
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because $COMMENT#DIRECTIVE21#USE_CLIENT_CONTEXTS#USE_AGNOSTIC_CONDITIONS
|
|
430
366
|
],
|
|
431
367
|
[USE_AGNOSTIC_CONDITIONS]: [
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
USE_AGNOSTIC_CONDITIONS,
|
|
454
|
-
USE_SERVER_FUNCTIONS
|
|
455
|
-
)} (Special) Server Functions are not accepted because (Special) Agnostic Conditions Components only take finite, imported components as arguments in their making. As such, assigning props to these components, including Server Functions, is not made within Agnostic Conditions Modules.`,
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
blockedImport: USE_CLIENT_CONTEXTS,
|
|
459
|
-
message: `${makeIntroForSpecificViolationMessage(
|
|
460
|
-
USE_AGNOSTIC_CONDITIONS,
|
|
461
|
-
USE_CLIENT_CONTEXTS
|
|
462
|
-
)} (Special) Client Contexts Components cannot be used as component arguments for (Special) Agnostic Conditions Components since they only take Lineal Components as arguments in their making.`,
|
|
463
|
-
},
|
|
464
|
-
// USE_AGNOSTIC_CONDITIONS allowed, because (Special) Agnostic Conditions Components, despite not being Lineal Components themselves, output components that can only be Lineal and compatible with their attributed rendering environments, making them acceptable arguments in the making of Agnostic Conditions Components.
|
|
465
|
-
],
|
|
466
|
-
[USE_AGNOSTIC_STRATEGIES]: [
|
|
467
|
-
// (Special) Agnostic Strategies Modules can import all known modules, except themselves since they cannot be imported as they are, only as and via Strategies. (Since Agnostic Strategies Modules cannot be imported as they are, there is no such things as a 'use agnostic strategies' importFileCommentedDirective.)
|
|
368
|
+
makeBlockedImport(
|
|
369
|
+
USE_AGNOSTIC_CONDITIONS,
|
|
370
|
+
USE_SERVER_LOGICS
|
|
371
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#USE_SERVER_LOGICS */,
|
|
372
|
+
makeBlockedImport(
|
|
373
|
+
USE_AGNOSTIC_CONDITIONS,
|
|
374
|
+
USE_CLIENT_LOGICS
|
|
375
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#USE_CLIENT_LOGICS */,
|
|
376
|
+
// USE_AGNOSTIC_LOGICS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#USE_AGNOSTIC_LOGICS
|
|
377
|
+
// USE_SERVER_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#USE_SERVER_COMPONENTS
|
|
378
|
+
// USE_CLIENT_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#USE_CLIENT_COMPONENTS
|
|
379
|
+
// USE_AGNOSTIC_COMPONENTS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#USE_AGNOSTIC_COMPONENTS
|
|
380
|
+
makeBlockedImport(
|
|
381
|
+
USE_AGNOSTIC_CONDITIONS,
|
|
382
|
+
USE_SERVER_FUNCTIONS
|
|
383
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#USE_SERVER_FUNCTIONS */,
|
|
384
|
+
makeBlockedImport(
|
|
385
|
+
USE_AGNOSTIC_CONDITIONS,
|
|
386
|
+
USE_CLIENT_CONTEXTS
|
|
387
|
+
) /* $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#USE_CLIENT_CONTEXTS */,
|
|
388
|
+
// USE_AGNOSTIC_CONDITIONS allowed, because $COMMENT#DIRECTIVE21#USE_AGNOSTIC_CONDITIONS#USE_AGNOSTIC_CONDITIONS
|
|
468
389
|
],
|
|
469
390
|
});
|
|
@@ -186,6 +186,9 @@ export const importsFlow = (context, node, currentFileCommentedDirective) => {
|
|
|
186
186
|
if (result.skip) return;
|
|
187
187
|
const { importedFileCommentedDirective } = result;
|
|
188
188
|
|
|
189
|
+
// returns early is the current file is an Agnostic Strategies Module
|
|
190
|
+
if (currentFileCommentedDirective === USE_AGNOSTIC_STRATEGIES) return;
|
|
191
|
+
|
|
189
192
|
if (
|
|
190
193
|
isImportBlocked(
|
|
191
194
|
currentFileCommentedDirective,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
exportNotStrategized,
|
|
3
|
-
commentedDirectives_commentedModules,
|
|
4
|
-
} from "../../../_commons/constants/bases.js";
|
|
1
|
+
import { exportNotStrategized } from "../../../_commons/constants/bases.js";
|
|
5
2
|
import {
|
|
6
3
|
USE_AGNOSTIC_LOGICS,
|
|
7
4
|
USE_AGNOSTIC_STRATEGIES,
|
|
@@ -138,7 +135,7 @@ export const getCommentedDirectiveFromCurrentModule = (context) => {
|
|
|
138
135
|
* - `'use agnostic strategies'`: Agnostic Strategies Modules may export JSX.
|
|
139
136
|
* @param {CommentedDirective} directive The commented directive as written on top of the file (cannot be `null` at that stage).
|
|
140
137
|
* @param {Extension} extension The JavaScript (TypeScript) extension of the file.
|
|
141
|
-
* @returns
|
|
138
|
+
* @returns The verified commented directive, from which imports rules are applied. Returns `null` if the verification failed, upon which an error will be reported depending on the commented directive, since the error logic here is strictly binary.
|
|
142
139
|
*/
|
|
143
140
|
export const getVerifiedCommentedDirective = (directive, extension) => {
|
|
144
141
|
const rule = commentedDirectives_extensionRules[directive];
|
|
@@ -226,8 +223,9 @@ export const getStrategizedDirective = (context, node) => {
|
|
|
226
223
|
|
|
227
224
|
/**
|
|
228
225
|
* Returns a boolean deciding if an imported file's commented directive is incompatible with the current file's commented directive.
|
|
229
|
-
* @
|
|
230
|
-
* @param {
|
|
226
|
+
* @template {CommentedDirectiveWithoutUseAgnosticStrategies} T
|
|
227
|
+
* @param {T} currentFileCommentedDirective The current file's commented directive.
|
|
228
|
+
* @param {T} importedFileCommentedDirective The imported file's commented directive.
|
|
231
229
|
* @returns `true` if the import is blocked, as established in `commentedDirectives_BlockedImports`.
|
|
232
230
|
*/
|
|
233
231
|
export const isImportBlocked = (
|
|
@@ -244,14 +242,13 @@ export const isImportBlocked = (
|
|
|
244
242
|
|
|
245
243
|
/**
|
|
246
244
|
* Lists in an message the commented modules incompatible with a commented module based on its commented directive.
|
|
247
|
-
* @param {
|
|
245
|
+
* @param {CommentedDirectiveWithoutUseAgnosticStrategies} commentedDirective The commented directive of the commented module.
|
|
248
246
|
* @returns The message listing the incompatible commented modules.
|
|
249
247
|
*/
|
|
250
248
|
export const makeMessageFromCurrentFileCommentedDirective = (
|
|
251
249
|
commentedDirective
|
|
252
250
|
) =>
|
|
253
251
|
makeMessageFromCurrentFileResolvedDirective(
|
|
254
|
-
commentedDirectives_commentedModules,
|
|
255
252
|
commentedDirectives_blockedImports,
|
|
256
253
|
commentedDirective
|
|
257
254
|
);
|
|
@@ -260,8 +257,9 @@ export const makeMessageFromCurrentFileCommentedDirective = (
|
|
|
260
257
|
|
|
261
258
|
/**
|
|
262
259
|
* Finds the `message` for the specific violation of commented directives import rules based on `commentedDirectives_BlockedImports`.
|
|
263
|
-
* @
|
|
264
|
-
* @param {
|
|
260
|
+
* @template {CommentedDirectiveWithoutUseAgnosticStrategies} T
|
|
261
|
+
* @param {T} currentFileCommentedDirective The current file's commented directive.
|
|
262
|
+
* @param {T} importedFileCommentedDirective The imported file's commented directive.
|
|
265
263
|
* @returns The corresponding `message`.
|
|
266
264
|
*/
|
|
267
265
|
export const findSpecificViolationMessage = (
|