eslint-plugin-use-agnostic 2.0.8 → 2.1.0
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/comments.config.json +4 -0
- package/comments.config.mjs +5 -1
- package/jscomments/jsdoc/comments.js +2 -0
- package/library/_commons/utilities/helpers.js +24 -24
- package/library/_commons/utilities/walk-ast.js +8 -8
- package/library/agnostic20/_commons/constants/bases.js +57 -57
- package/library/agnostic20/_commons/utilities/flows.js +26 -26
- package/library/agnostic20/_commons/utilities/helpers.js +43 -43
- package/library/agnostic20/config.js +3 -3
- package/library/directive21/_commons/constants/bases.js +105 -105
- package/library/directive21/_commons/rules/import-rules.js +18 -7
- package/library/directive21/_commons/utilities/analyze-exports-re.js +3 -3
- package/library/directive21/_commons/utilities/flows.js +61 -83
- package/library/directive21/_commons/utilities/helpers.js +85 -85
- package/library/directive21/config.js +3 -3
- package/library/index.js +8 -8
- package/package.json +1 -1
- package/types/index.d.ts +114 -114
|
@@ -141,7 +141,7 @@ export const AT_SERVER_FUNCTIONS =
|
|
|
141
141
|
export const AT_CLIENT_CONTEXTS =
|
|
142
142
|
commentVariablesData.directive21["use client contexts"].atStrategy.value;
|
|
143
143
|
// export const AT_AGNOSTIC_CONDITIONS =
|
|
144
|
-
// commentVariablesData.directive21["use agnostic conditions"].atStrategy.value; //
|
|
144
|
+
// commentVariablesData.directive21["use agnostic conditions"].atStrategy.value; // Agnostic Conditions Modules no longer output from Agnostic Strategies Modules.
|
|
145
145
|
|
|
146
146
|
// commented strategies array
|
|
147
147
|
/** @type {CommentedStrategies} */
|
|
@@ -209,12 +209,12 @@ export const commentedDirectives_verificationReports = Object.freeze({
|
|
|
209
209
|
/* commentedDirectives_blockedImports */
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
212
|
+
* Makes a blockedImport object for the identified blocked import at hand.
|
|
213
213
|
* @template {CommentedDirective} T
|
|
214
214
|
* @template {CommentedDirective} U
|
|
215
|
-
* @param {T} currentFileCommentedDirective
|
|
216
|
-
* @param {U} importedFileCommentedDirective
|
|
217
|
-
* @returns
|
|
215
|
+
* @param {T} currentFileCommentedDirective The current file's commented directive.
|
|
216
|
+
* @param {U} importedFileCommentedDirective The imported file's commented directive.
|
|
217
|
+
* @returns The blockedImport object for the identified blocked import at hand.
|
|
218
218
|
*/
|
|
219
219
|
export const makeBlockedImport = (
|
|
220
220
|
currentFileCommentedDirective,
|
|
@@ -235,244 +235,244 @@ export const makeBlockedImport = (
|
|
|
235
235
|
|
|
236
236
|
export const commentedDirectives_blockedImports = Object.freeze({
|
|
237
237
|
[USE_SERVER_LOGICS]: Object.freeze([
|
|
238
|
-
// USE_SERVER_LOGICS
|
|
238
|
+
// USE_SERVER_LOGICS Prime Server Logics can compose with one another.
|
|
239
239
|
makeBlockedImport(
|
|
240
240
|
USE_SERVER_LOGICS,
|
|
241
241
|
USE_CLIENT_LOGICS,
|
|
242
|
-
) /*
|
|
243
|
-
// USE_AGNOSTIC_LOGICS
|
|
244
|
-
// USE_SERVER_COMPONENTS
|
|
242
|
+
) /* Prime Client Logics should never leak to the server. */,
|
|
243
|
+
// USE_AGNOSTIC_LOGICS Prime Agnostic Logics can run safely on the server just like they can on the client.
|
|
244
|
+
// USE_SERVER_COMPONENTS Lineal Server Components are OK to be composed with Prime Server Logics as long as the Prime Server Logics Module, by convention, does not export React components.
|
|
245
245
|
makeBlockedImport(
|
|
246
246
|
USE_SERVER_LOGICS,
|
|
247
247
|
USE_CLIENT_COMPONENTS,
|
|
248
|
-
) /*
|
|
249
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
250
|
-
// USE_SERVER_FUNCTIONS
|
|
248
|
+
) /* Lineal Client Components, like any Client Components, cannot be tinkered with on the server. */,
|
|
249
|
+
// USE_AGNOSTIC_COMPONENTS 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.
|
|
250
|
+
// USE_SERVER_FUNCTIONS (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.)
|
|
251
251
|
makeBlockedImport(
|
|
252
252
|
USE_SERVER_LOGICS,
|
|
253
253
|
USE_CLIENT_CONTEXTS,
|
|
254
|
-
) /*
|
|
255
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
254
|
+
) /* (Special) Client Contexts Components, like any Client Components, cannot be tinkered with on the server. */,
|
|
255
|
+
// USE_AGNOSTIC_CONDITIONS (Special) Agnostic Conditions Components and/or Logics, as if they were Lineal Agnostic Components and/or Prime Agnostic Logics themselves, can render safely on the server just like they can on the client.
|
|
256
256
|
makeBlockedImport(
|
|
257
257
|
USE_SERVER_LOGICS,
|
|
258
258
|
USE_AGNOSTIC_STRATEGIES,
|
|
259
|
-
) /*
|
|
259
|
+
) /* (Special) Agnostic Strategies Modules cannot be imported by any of the known modules, since given that Agnostic Strategies Modules generate strategized files, they need to be imported via their strategized files (like those ending in `.serverLogics.ts`) instead. */,
|
|
260
260
|
]),
|
|
261
261
|
[USE_CLIENT_LOGICS]: Object.freeze([
|
|
262
262
|
makeBlockedImport(
|
|
263
263
|
USE_CLIENT_LOGICS,
|
|
264
264
|
USE_SERVER_LOGICS,
|
|
265
|
-
) /*
|
|
266
|
-
// USE_CLIENT_LOGICS
|
|
267
|
-
// USE_AGNOSTIC_LOGICS
|
|
265
|
+
) /* Prime Server Logics should never leak to the client. */,
|
|
266
|
+
// USE_CLIENT_LOGICS Prime Client Logics can compose with one another.
|
|
267
|
+
// USE_AGNOSTIC_LOGICS Prime Agnostic Logics can run safely on the client just like they can on the server.
|
|
268
268
|
makeBlockedImport(
|
|
269
269
|
USE_CLIENT_LOGICS,
|
|
270
270
|
USE_SERVER_COMPONENTS,
|
|
271
|
-
) /*
|
|
272
|
-
// USE_CLIENT_COMPONENTS
|
|
273
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
274
|
-
// USE_SERVER_FUNCTIONS
|
|
275
|
-
// USE_CLIENT_CONTEXTS
|
|
276
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
271
|
+
) /* Lineal Server Components cannot be tinkered with on the client. */,
|
|
272
|
+
// USE_CLIENT_COMPONENTS 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.
|
|
273
|
+
// USE_AGNOSTIC_COMPONENTS 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.
|
|
274
|
+
// USE_SERVER_FUNCTIONS (Special) Server Functions can technically be attached to any Client Components being tinkered with within Client Logics Modules.
|
|
275
|
+
// USE_CLIENT_CONTEXTS (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.
|
|
276
|
+
// USE_AGNOSTIC_CONDITIONS (Special) Agnostic Conditions Components and/or Logics, as if they were Lineal Agnostic Components and/or Prime Agnostic Logics themselves, can render safely on the client just like they can on the server.
|
|
277
277
|
makeBlockedImport(
|
|
278
278
|
USE_CLIENT_LOGICS,
|
|
279
279
|
USE_AGNOSTIC_STRATEGIES,
|
|
280
|
-
) /*
|
|
280
|
+
) /* (Special) Agnostic Strategies Modules cannot be imported by any of the known modules, since given that Agnostic Strategies Modules generate strategized files, they need to be imported via their strategized files (like those ending in `.serverLogics.ts`) instead. */,
|
|
281
281
|
]),
|
|
282
282
|
[USE_AGNOSTIC_LOGICS]: Object.freeze([
|
|
283
283
|
makeBlockedImport(
|
|
284
284
|
USE_AGNOSTIC_LOGICS,
|
|
285
285
|
USE_SERVER_LOGICS,
|
|
286
|
-
) /*
|
|
286
|
+
) /* Prime Server Logics cannot run on both the server and the client. */,
|
|
287
287
|
makeBlockedImport(
|
|
288
288
|
USE_AGNOSTIC_LOGICS,
|
|
289
289
|
USE_CLIENT_LOGICS,
|
|
290
|
-
) /*
|
|
291
|
-
// USE_AGNOSTIC_LOGICS
|
|
290
|
+
) /* Prime Client Logics cannot run on both the server and the client. */,
|
|
291
|
+
// USE_AGNOSTIC_LOGICS Prime Agnostic Logics can compose with one another.
|
|
292
292
|
makeBlockedImport(
|
|
293
293
|
USE_AGNOSTIC_LOGICS,
|
|
294
294
|
USE_SERVER_COMPONENTS,
|
|
295
|
-
) /*
|
|
295
|
+
) /* Lineal Server Components cannot be tinkered with on both the server and the client. */,
|
|
296
296
|
makeBlockedImport(
|
|
297
297
|
USE_AGNOSTIC_LOGICS,
|
|
298
298
|
USE_CLIENT_COMPONENTS,
|
|
299
|
-
) /*
|
|
300
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
299
|
+
) /* Lineal Client Components, like any Client Components, cannot be tinkered with on both the server and the client. */,
|
|
300
|
+
// USE_AGNOSTIC_COMPONENTS 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.
|
|
301
301
|
makeBlockedImport(
|
|
302
302
|
USE_AGNOSTIC_LOGICS,
|
|
303
303
|
USE_SERVER_FUNCTIONS,
|
|
304
|
-
) /*
|
|
304
|
+
) /* (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. */,
|
|
305
305
|
makeBlockedImport(
|
|
306
306
|
USE_AGNOSTIC_LOGICS,
|
|
307
307
|
USE_CLIENT_CONTEXTS,
|
|
308
|
-
) /*
|
|
308
|
+
) /* (Special) Client Contexts Components, like any Client Components, cannot be tinkered with on both the server and the client. */,
|
|
309
309
|
makeBlockedImport(
|
|
310
310
|
USE_AGNOSTIC_LOGICS,
|
|
311
311
|
USE_AGNOSTIC_CONDITIONS,
|
|
312
|
-
) /*
|
|
312
|
+
) /* (Special) Agnostic Conditions Modules cannot be imported in the (Abstract) Agnostic Environment, only strictly on the server or strictly on the client. */,
|
|
313
313
|
makeBlockedImport(
|
|
314
314
|
USE_AGNOSTIC_LOGICS,
|
|
315
315
|
USE_AGNOSTIC_STRATEGIES,
|
|
316
|
-
) /*
|
|
316
|
+
) /* (Special) Agnostic Strategies Modules cannot be imported by any of the known modules, since given that Agnostic Strategies Modules generate strategized files, they need to be imported via their strategized files (like those ending in `.serverLogics.ts`) instead. */,
|
|
317
317
|
]),
|
|
318
318
|
[USE_SERVER_COMPONENTS]: Object.freeze([
|
|
319
|
-
// USE_SERVER_LOGICS
|
|
319
|
+
// USE_SERVER_LOGICS Prime Server Logics, being logic from the server, can safely support Lineal Server Components.
|
|
320
320
|
makeBlockedImport(
|
|
321
321
|
USE_SERVER_COMPONENTS,
|
|
322
322
|
USE_CLIENT_LOGICS,
|
|
323
|
-
) /*
|
|
324
|
-
// USE_AGNOSTIC_LOGICS
|
|
325
|
-
// USE_SERVER_COMPONENTS
|
|
326
|
-
// USE_CLIENT_COMPONENTS
|
|
327
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
328
|
-
// USE_SERVER_FUNCTIONS
|
|
329
|
-
// USE_CLIENT_CONTEXTS
|
|
330
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
323
|
+
) /* Prime Client Logics should never leak to the server. */,
|
|
324
|
+
// USE_AGNOSTIC_LOGICS Prime Agnostic Logics can run safely on the server just like they can on the client.
|
|
325
|
+
// USE_SERVER_COMPONENTS Lineal Server Components can compose with one another, now that thanks to the inclusion of Agnostic Components they are actual Server Components.
|
|
326
|
+
// USE_CLIENT_COMPONENTS Lineal Client Components can be nested inside Lineal Server Components to create client boundaries when the root of the application is planted on the server.
|
|
327
|
+
// USE_AGNOSTIC_COMPONENTS Lineal Agnostic Components can render safely on the server just like they can on the client.
|
|
328
|
+
// USE_SERVER_FUNCTIONS (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.
|
|
329
|
+
// USE_CLIENT_CONTEXTS (Special) Client Contexts Components can be nested inside Lineal 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.
|
|
330
|
+
// USE_AGNOSTIC_CONDITIONS (Special) Agnostic Conditions Components and/or Logics, as if they were Lineal Agnostic Components and/or Prime Agnostic Logics themselves, can render safely on the server just like they can on the client.
|
|
331
331
|
makeBlockedImport(
|
|
332
332
|
USE_SERVER_COMPONENTS,
|
|
333
333
|
USE_AGNOSTIC_STRATEGIES,
|
|
334
|
-
) /*
|
|
334
|
+
) /* (Special) Agnostic Strategies Modules cannot be imported by any of the known modules, since given that Agnostic Strategies Modules generate strategized files, they need to be imported via their strategized files (like those ending in `.serverLogics.ts`) instead. */,
|
|
335
335
|
]),
|
|
336
336
|
[USE_CLIENT_COMPONENTS]: Object.freeze([
|
|
337
337
|
makeBlockedImport(
|
|
338
338
|
USE_CLIENT_COMPONENTS,
|
|
339
339
|
USE_SERVER_LOGICS,
|
|
340
|
-
) /*
|
|
341
|
-
// USE_CLIENT_LOGICS
|
|
342
|
-
// USE_AGNOSTIC_LOGICS
|
|
340
|
+
) /* Prime Server Logics should never leak to the client. */,
|
|
341
|
+
// USE_CLIENT_LOGICS Prime Client Logics, being logic from the client, can safely support Lineal Client Components, like any Client Components.
|
|
342
|
+
// USE_AGNOSTIC_LOGICS Prime Agnostic Logics can run safely on the client just like they can on the server.
|
|
343
343
|
makeBlockedImport(
|
|
344
344
|
USE_CLIENT_COMPONENTS,
|
|
345
345
|
USE_SERVER_COMPONENTS,
|
|
346
|
-
) /*
|
|
347
|
-
// USE_CLIENT_COMPONENTS
|
|
348
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
349
|
-
// USE_SERVER_FUNCTIONS
|
|
350
|
-
// USE_CLIENT_CONTEXTS
|
|
351
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
346
|
+
) /* Lineal Server Components cannot be the children of Lineal Client Components. */,
|
|
347
|
+
// USE_CLIENT_COMPONENTS Lineal Client Components can compose with one another.
|
|
348
|
+
// USE_AGNOSTIC_COMPONENTS Lineal Agnostic Components can render safely on the client just like they can on the server.
|
|
349
|
+
// USE_SERVER_FUNCTIONS (Special) Server Functions can be specifically triggered by Client Components.
|
|
350
|
+
// USE_CLIENT_CONTEXTS (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 grandchildren of an ancestor Lineal Client Component, enforcing them to render exclusively on the client.
|
|
351
|
+
// USE_AGNOSTIC_CONDITIONS (Special) Agnostic Conditions Components and/or Logics, as if they were Lineal Agnostic Components and/or Prime Agnostic Logics themselves, can render safely on the client just like they can on the server.
|
|
352
352
|
makeBlockedImport(
|
|
353
353
|
USE_CLIENT_COMPONENTS,
|
|
354
354
|
USE_AGNOSTIC_STRATEGIES,
|
|
355
|
-
) /*
|
|
355
|
+
) /* (Special) Agnostic Strategies Modules cannot be imported by any of the known modules, since given that Agnostic Strategies Modules generate strategized files, they need to be imported via their strategized files (like those ending in `.serverLogics.ts`) instead. */,
|
|
356
356
|
]),
|
|
357
357
|
[USE_AGNOSTIC_COMPONENTS]: Object.freeze([
|
|
358
358
|
makeBlockedImport(
|
|
359
359
|
USE_AGNOSTIC_COMPONENTS,
|
|
360
360
|
USE_SERVER_LOGICS,
|
|
361
|
-
) /*
|
|
361
|
+
) /* Prime Server Logics cannot run on both the server and the client. */,
|
|
362
362
|
makeBlockedImport(
|
|
363
363
|
USE_AGNOSTIC_COMPONENTS,
|
|
364
364
|
USE_CLIENT_LOGICS,
|
|
365
|
-
) /*
|
|
366
|
-
// USE_AGNOSTIC_LOGICS
|
|
365
|
+
) /* Prime Client Logics cannot run on both the server and the client. */,
|
|
366
|
+
// USE_AGNOSTIC_LOGICS Prime Agnostic Logics, being environment-agnostic logic, can safely support any Agnostic Components.
|
|
367
367
|
makeBlockedImport(
|
|
368
368
|
USE_AGNOSTIC_COMPONENTS,
|
|
369
369
|
USE_SERVER_COMPONENTS,
|
|
370
|
-
) /*
|
|
371
|
-
// USE_CLIENT_COMPONENTS
|
|
372
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
373
|
-
// USE_SERVER_FUNCTIONS
|
|
374
|
-
// USE_CLIENT_CONTEXTS
|
|
370
|
+
) /* 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. */,
|
|
371
|
+
// USE_CLIENT_COMPONENTS Lineal Client Components can be nested inside Lineal Agnostic Components to create client boundaries when the root of the application is planted on the server.
|
|
372
|
+
// USE_AGNOSTIC_COMPONENTS Lineal Agnostic Components can compose with one another.
|
|
373
|
+
// USE_SERVER_FUNCTIONS (Special) Server Functions can be passed to Client Components as props when Client Components are also legally imported into Agnostic Components Modules.
|
|
374
|
+
// USE_CLIENT_CONTEXTS (Special) Client Contexts Components can be nested inside Lineal 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.
|
|
375
375
|
makeBlockedImport(
|
|
376
376
|
USE_AGNOSTIC_COMPONENTS,
|
|
377
377
|
USE_AGNOSTIC_CONDITIONS,
|
|
378
|
-
) /*
|
|
378
|
+
) /* (Special) Agnostic Conditions Modules cannot be imported in the (Abstract) Agnostic Environment, only strictly on the server or strictly on the client. */,
|
|
379
379
|
makeBlockedImport(
|
|
380
380
|
USE_AGNOSTIC_COMPONENTS,
|
|
381
381
|
USE_AGNOSTIC_STRATEGIES,
|
|
382
|
-
) /*
|
|
382
|
+
) /* (Special) Agnostic Strategies Modules cannot be imported by any of the known modules, since given that Agnostic Strategies Modules generate strategized files, they need to be imported via their strategized files (like those ending in `.serverLogics.ts`) instead. */,
|
|
383
383
|
]),
|
|
384
384
|
[USE_SERVER_FUNCTIONS]: Object.freeze([
|
|
385
|
-
// USE_SERVER_LOGICS
|
|
385
|
+
// USE_SERVER_LOGICS Prime Server Logics, being logic from the server, can safely support (Special) Server Functions.
|
|
386
386
|
makeBlockedImport(
|
|
387
387
|
USE_SERVER_FUNCTIONS,
|
|
388
388
|
USE_CLIENT_LOGICS,
|
|
389
|
-
) /*
|
|
390
|
-
// USE_AGNOSTIC_LOGICS
|
|
389
|
+
) /* Prime Client Logics should never leak to the server. */,
|
|
390
|
+
// USE_AGNOSTIC_LOGICS Prime Agnostic Logics can run safely on the server just like they can on the client.
|
|
391
391
|
makeBlockedImport(
|
|
392
392
|
USE_SERVER_FUNCTIONS,
|
|
393
393
|
USE_SERVER_COMPONENTS,
|
|
394
|
-
) /*
|
|
394
|
+
) /* Lineal Server Components aren't allowed because (Special) Server Functions have no business working with React Components. */,
|
|
395
395
|
makeBlockedImport(
|
|
396
396
|
USE_SERVER_FUNCTIONS,
|
|
397
397
|
USE_CLIENT_COMPONENTS,
|
|
398
|
-
) /*
|
|
398
|
+
) /* Lineal Client Components aren't allowed because (Special) Server Functions have no business working with React Components. */,
|
|
399
399
|
makeBlockedImport(
|
|
400
400
|
USE_SERVER_FUNCTIONS,
|
|
401
401
|
USE_AGNOSTIC_COMPONENTS,
|
|
402
|
-
) /*
|
|
403
|
-
// USE_SERVER_FUNCTIONS
|
|
402
|
+
) /* Lineal Agnostic Components aren't allowed because (Special) Server Functions have no business working with React Components. */,
|
|
403
|
+
// USE_SERVER_FUNCTIONS (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.)
|
|
404
404
|
makeBlockedImport(
|
|
405
405
|
USE_SERVER_FUNCTIONS,
|
|
406
406
|
USE_CLIENT_CONTEXTS,
|
|
407
|
-
) /*
|
|
407
|
+
) /* (Special) Client Contexts Components aren't allowed because (Special) Server Functions have no business working with React Components. */,
|
|
408
408
|
makeBlockedImport(
|
|
409
409
|
USE_SERVER_FUNCTIONS,
|
|
410
410
|
USE_AGNOSTIC_CONDITIONS,
|
|
411
|
-
) /*
|
|
411
|
+
) /* (Special) Agnostic Conditions Components and/or Logics aren't allowed because (Special) Server Functions have no business working with React Components. */,
|
|
412
412
|
makeBlockedImport(
|
|
413
413
|
USE_SERVER_FUNCTIONS,
|
|
414
414
|
USE_AGNOSTIC_STRATEGIES,
|
|
415
|
-
) /*
|
|
415
|
+
) /* (Special) Agnostic Strategies Modules cannot be imported by any of the known modules, since given that Agnostic Strategies Modules generate strategized files, they need to be imported via their strategized files (like those ending in `.serverLogics.ts`) instead. */,
|
|
416
416
|
]),
|
|
417
417
|
[USE_CLIENT_CONTEXTS]: Object.freeze([
|
|
418
418
|
makeBlockedImport(
|
|
419
419
|
USE_CLIENT_CONTEXTS,
|
|
420
420
|
USE_SERVER_LOGICS,
|
|
421
|
-
) /*
|
|
422
|
-
// USE_CLIENT_LOGICS
|
|
423
|
-
// USE_AGNOSTIC_LOGICS
|
|
421
|
+
) /* Prime Server Logics should never leak to the client. */,
|
|
422
|
+
// USE_CLIENT_LOGICS Prime Client Logics, being logic from the client, can safely support (Special) Client Contexts Components, like any Client Components.
|
|
423
|
+
// USE_AGNOSTIC_LOGICS Prime Agnostic Logics can run safely on the client just like they can on the server.
|
|
424
424
|
makeBlockedImport(
|
|
425
425
|
USE_CLIENT_CONTEXTS,
|
|
426
426
|
USE_SERVER_COMPONENTS,
|
|
427
|
-
) /*
|
|
428
|
-
// USE_CLIENT_COMPONENTS
|
|
429
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
430
|
-
// USE_SERVER_FUNCTIONS
|
|
431
|
-
// USE_CLIENT_CONTEXTS
|
|
432
|
-
// USE_AGNOSTIC_CONDITIONS
|
|
427
|
+
) /* Lineal Server Components may only pass through (Special) Client Contexts Components via the children prop within Server Components Modules. */,
|
|
428
|
+
// USE_CLIENT_COMPONENTS Lineal Client Components can create client boundaries within (Special) Client Contexts Components.
|
|
429
|
+
// USE_AGNOSTIC_COMPONENTS Lineal Agnostic Components can render safely on the client just like they can on the server.
|
|
430
|
+
// USE_SERVER_FUNCTIONS (Special) Server Functions can be specifically triggered by Client Components.
|
|
431
|
+
// USE_CLIENT_CONTEXTS (Special) Client Contexts Components can compose with one another.
|
|
432
|
+
// USE_AGNOSTIC_CONDITIONS (Special) Agnostic Conditions Components and/or Logics, as if they were Lineal Agnostic Components and/or Prime Agnostic Logics themselves, can render safely on the client just like they can on the server.
|
|
433
433
|
makeBlockedImport(
|
|
434
434
|
USE_CLIENT_CONTEXTS,
|
|
435
435
|
USE_AGNOSTIC_STRATEGIES,
|
|
436
|
-
) /*
|
|
436
|
+
) /* (Special) Agnostic Strategies Modules cannot be imported by any of the known modules, since given that Agnostic Strategies Modules generate strategized files, they need to be imported via their strategized files (like those ending in `.serverLogics.ts`) instead. */,
|
|
437
437
|
]),
|
|
438
438
|
[USE_AGNOSTIC_CONDITIONS]: Object.freeze([
|
|
439
|
-
// USE_SERVER_LOGICS
|
|
440
|
-
// USE_CLIENT_LOGICS
|
|
441
|
-
// USE_AGNOSTIC_LOGICS
|
|
442
|
-
// USE_SERVER_COMPONENTS
|
|
443
|
-
// USE_CLIENT_COMPONENTS
|
|
444
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
439
|
+
// USE_SERVER_LOGICS Prime Server Logics are to be paired as `LogicForServer` utilities with `LogicForClient` utilities to form (Special) Agnostic Conditions Logics. The `LogicForServer` is always the first assigned. The exported variable should be prefixed by `utilize-`, like `utilizeUtility`.
|
|
440
|
+
// USE_CLIENT_LOGICS Prime Client Logics are to be paired as `LogicForClient` utilities with `LogicForServer` utilities to form (Special) Agnostic Conditions Logics. The `LogicForClient` is always the last assigned. The exported variable should be prefixed by `utilize-`, like `utilizeUtility`.
|
|
441
|
+
// USE_AGNOSTIC_LOGICS Prime Agnostic Logics can take the place of `LogicForServer` and/or `LogicForClient` utilities to form (Special) Agnostic Conditions Logics. The exported variable should be prefixed by `utilize-`, like `utilizeUtility`.
|
|
442
|
+
// USE_SERVER_COMPONENTS Lineal Server Components are to be paired as `ComponentForServer` components with `ComponentForClient` components to form (Special) Agnostic Conditions Components. The `ComponentForServer` is always the first assigned. The exported variable should be in PascalCase, like `ReactComponent`.
|
|
443
|
+
// USE_CLIENT_COMPONENTS Lineal Client Components are to be paired as `ComponentForClient` components with `ComponentForServer` components to form (Special) Agnostic Conditions Components. The `ComponentForClient` is always the last assigned. The exported variable should be in PascalCase, like `ReactComponent`.
|
|
444
|
+
// USE_AGNOSTIC_COMPONENTS Lineal Agnostic Components can take the place of `ComponentForServer` and/or `ComponentForClient` components to form (Special) Agnostic Conditions Components. The exported variable should be in PascalCase, like `ReactComponent`.
|
|
445
445
|
makeBlockedImport(
|
|
446
446
|
USE_AGNOSTIC_CONDITIONS,
|
|
447
447
|
USE_SERVER_FUNCTIONS,
|
|
448
|
-
) /*
|
|
449
|
-
// USE_CLIENT_CONTEXTS
|
|
448
|
+
) /* (Special) Server Functions aren't allowed because they do not have 1-to-1 behavioral equivalents for the client that would satisfy (Special) Agnostic Conditions Modules. */,
|
|
449
|
+
// USE_CLIENT_CONTEXTS (Special) Client Contexts Components can actually be used as `ComponentForClient` arguments for (Special) Agnostic Conditions Components notably as counterparts to similar passthrough components selected as `ComponentForServer` arguments.
|
|
450
450
|
makeBlockedImport(
|
|
451
451
|
USE_AGNOSTIC_CONDITIONS,
|
|
452
452
|
USE_AGNOSTIC_CONDITIONS,
|
|
453
|
-
) /*
|
|
453
|
+
) /* (Special) Agnostic Conditions Modules cannot be imported in the (Abstract) Agnostic Environment, only strictly on the server or strictly on the client. */,
|
|
454
454
|
makeBlockedImport(
|
|
455
455
|
USE_AGNOSTIC_CONDITIONS,
|
|
456
456
|
USE_AGNOSTIC_STRATEGIES,
|
|
457
|
-
) /*
|
|
457
|
+
) /* (Special) Agnostic Strategies Modules cannot be imported by any of the known modules, since given that Agnostic Strategies Modules generate strategized files, they need to be imported via their strategized files (like those ending in `.serverLogics.ts`) instead. */,
|
|
458
458
|
]),
|
|
459
459
|
[USE_AGNOSTIC_STRATEGIES]: Object.freeze([
|
|
460
|
-
// USE_SERVER_LOGICS
|
|
461
|
-
// USE_CLIENT_LOGICS
|
|
462
|
-
// USE_AGNOSTIC_LOGICS
|
|
463
|
-
// USE_SERVER_COMPONENTS
|
|
464
|
-
// USE_CLIENT_COMPONENTS
|
|
465
|
-
// USE_AGNOSTIC_COMPONENTS
|
|
466
|
-
// USE_SERVER_FUNCTIONS
|
|
467
|
-
// USE_CLIENT_CONTEXTS
|
|
460
|
+
// USE_SERVER_LOGICS Prime Server Logics allowed, because (Special) Agnostic Strategies Modules can import all known modules except Special Agnostic Modules, meaning themselves as file generators that should not be imported directly and (Special) Agnostic Conditions Modules which cannot be imported in the (Abstract) Agnostic Environment.
|
|
461
|
+
// USE_CLIENT_LOGICS Prime Client Logics allowed, because (Special) Agnostic Strategies Modules can import all known modules except Special Agnostic Modules, meaning themselves as file generators that should not be imported directly and (Special) Agnostic Conditions Modules which cannot be imported in the (Abstract) Agnostic Environment.
|
|
462
|
+
// USE_AGNOSTIC_LOGICS Prime Agnostic Logics allowed, because (Special) Agnostic Strategies Modules can import all known modules except Special Agnostic Modules, meaning themselves as file generators that should not be imported directly and (Special) Agnostic Conditions Modules which cannot be imported in the (Abstract) Agnostic Environment.
|
|
463
|
+
// USE_SERVER_COMPONENTS Lineal Server Components allowed, because (Special) Agnostic Strategies Modules can import all known modules except Special Agnostic Modules, meaning themselves as file generators that should not be imported directly and (Special) Agnostic Conditions Modules which cannot be imported in the (Abstract) Agnostic Environment.
|
|
464
|
+
// USE_CLIENT_COMPONENTS Lineal Client Components allowed, because (Special) Agnostic Strategies Modules can import all known modules except Special Agnostic Modules, meaning themselves as file generators that should not be imported directly and (Special) Agnostic Conditions Modules which cannot be imported in the (Abstract) Agnostic Environment.
|
|
465
|
+
// USE_AGNOSTIC_COMPONENTS Lineal Agnostic Components allowed, because (Special) Agnostic Strategies Modules can import all known modules except Special Agnostic Modules, meaning themselves as file generators that should not be imported directly and (Special) Agnostic Conditions Modules which cannot be imported in the (Abstract) Agnostic Environment.
|
|
466
|
+
// USE_SERVER_FUNCTIONS (Special) Server Functions allowed, because (Special) Agnostic Strategies Modules can import all known modules except Special Agnostic Modules, meaning themselves as file generators that should not be imported directly and (Special) Agnostic Conditions Modules which cannot be imported in the (Abstract) Agnostic Environment.
|
|
467
|
+
// USE_CLIENT_CONTEXTS (Special) Client Contexts Components allowed, because (Special) Agnostic Strategies Modules can import all known modules except Special Agnostic Modules, meaning themselves as file generators that should not be imported directly and (Special) Agnostic Conditions Modules which cannot be imported in the (Abstract) Agnostic Environment.
|
|
468
468
|
makeBlockedImport(
|
|
469
469
|
USE_AGNOSTIC_STRATEGIES,
|
|
470
470
|
USE_AGNOSTIC_CONDITIONS,
|
|
471
|
-
) /*
|
|
471
|
+
) /* (Special) Agnostic Conditions Modules cannot be imported in the (Abstract) Agnostic Environment, only strictly on the server or strictly on the client. */,
|
|
472
472
|
makeBlockedImport(
|
|
473
473
|
USE_AGNOSTIC_STRATEGIES,
|
|
474
474
|
USE_AGNOSTIC_STRATEGIES,
|
|
475
|
-
) /*
|
|
475
|
+
) /* (Special) Agnostic Strategies Modules cannot be imported by any of the known modules, since given that Agnostic Strategies Modules generate strategized files, they need to be imported via their strategized files (like those ending in `.serverLogics.ts`) instead. */,
|
|
476
476
|
]),
|
|
477
477
|
});
|
|
478
478
|
|
|
@@ -88,24 +88,19 @@ In this context, {{ ${specificFailure} }} `,
|
|
|
88
88
|
const rootPath = /** @type {string | undefined} */ (
|
|
89
89
|
context.settings.eXtraJSX?.rootPath
|
|
90
90
|
);
|
|
91
|
-
console.debug("reactFolder is:", reactFolder);
|
|
92
|
-
console.debug("rootPath is:", rootPath);
|
|
93
91
|
|
|
94
92
|
if (!reactFolder || !rootPath) return {};
|
|
95
|
-
// make the resolver by resolving
|
|
96
|
-
// pass the resolver to importsFlow, allExportsFlow, importsFlowRequire (resolver.resolveFileSync, getCommentedDirectiveFromModule)
|
|
93
|
+
// make the resolver by resolving TypeScript from the rootPath (getTsConfigPaths, makeAbsoluteFromTsConfigPaths, makeResolverFromAbsoluteTsConfigPaths) // DONE.
|
|
94
|
+
// pass the resolver to importsFlow, allExportsFlow, importsFlowRequire (resolver.resolveFileSync, getCommentedDirectiveFromModule) // DONE. getCommentedDirectiveFromModule CANCELLED.
|
|
97
95
|
|
|
98
96
|
const tsConfigPaths = getTsConfigPaths(rootPath);
|
|
99
|
-
console.debug("tsConfigPaths is:", tsConfigPaths);
|
|
100
97
|
const absoluteTsConfigPaths = makeAbsoluteFromTsConfigPaths(
|
|
101
98
|
rootPath,
|
|
102
99
|
tsConfigPaths,
|
|
103
100
|
);
|
|
104
|
-
console.debug("absoluteTsConfigPaths is:", absoluteTsConfigPaths);
|
|
105
101
|
const resolver = makeResolverFromAbsoluteTsConfigPaths(
|
|
106
102
|
absoluteTsConfigPaths,
|
|
107
103
|
);
|
|
108
|
-
console.debug("resolver is:", resolver);
|
|
109
104
|
|
|
110
105
|
if (result.skip) return {};
|
|
111
106
|
const { verifiedCommentedDirective } = result; // Leave untouched. Since this is the verifying process. Commented directives from imported modules however, don't need to be further verified, and can simply be obtained by the flat module index.
|
|
@@ -134,6 +129,11 @@ In this context, {{ ${specificFailure} }} `,
|
|
|
134
129
|
},
|
|
135
130
|
};
|
|
136
131
|
|
|
132
|
+
/**
|
|
133
|
+
* (directly copied from Extra JavaScript, so trust me bro)
|
|
134
|
+
* @param {string} rootPath
|
|
135
|
+
* @returns
|
|
136
|
+
*/
|
|
137
137
|
const getTsConfigPaths = (rootPath) => {
|
|
138
138
|
const tsConfigJsonPath = path.join(rootPath, "tsconfig.json");
|
|
139
139
|
const parsed = ts.getParsedCommandLineOfConfigFile(
|
|
@@ -148,6 +148,12 @@ const getTsConfigPaths = (rootPath) => {
|
|
|
148
148
|
return paths;
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
+
/**
|
|
152
|
+
* (directly copied from Extra JavaScript, so trust me bro)
|
|
153
|
+
* @param {string} rootPath
|
|
154
|
+
* @param {ts.MapLike<string[]>} tsConfigPaths
|
|
155
|
+
* @returns
|
|
156
|
+
*/
|
|
151
157
|
const makeAbsoluteFromTsConfigPaths = (rootPath, tsConfigPaths) => {
|
|
152
158
|
/** @type {Record<string, string[]>} */
|
|
153
159
|
const results = {};
|
|
@@ -161,6 +167,11 @@ const makeAbsoluteFromTsConfigPaths = (rootPath, tsConfigPaths) => {
|
|
|
161
167
|
return results;
|
|
162
168
|
};
|
|
163
169
|
|
|
170
|
+
/**
|
|
171
|
+
* (directly copied from Extra JavaScript, so trust me bro)
|
|
172
|
+
* @param {Record<string, string[]>} absoluteTsConfigPaths
|
|
173
|
+
* @returns
|
|
174
|
+
*/
|
|
164
175
|
const makeResolverFromAbsoluteTsConfigPaths = (absoluteTsConfigPaths) =>
|
|
165
176
|
new ResolverFactory({
|
|
166
177
|
extensions: EXTENSIONS,
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
import { walkAST } from "../../../_commons/utilities/walk-ast.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param {SourceCode} sourceCode
|
|
16
|
-
* @returns
|
|
14
|
+
* Analyzes a source code's exports to detect re-exports.
|
|
15
|
+
* @param {SourceCode} sourceCode The `SourceCode` to analyze.
|
|
16
|
+
* @returns An object with the `reExportsWithSource` key tracking the direct re-exports from an imported source in an array and the `reExportsViaLocal` key tracking the indirect re-exports from an imported source in an array.
|
|
17
17
|
*/
|
|
18
18
|
export const analyzeExportsForReExports = (sourceCode) => {
|
|
19
19
|
/** @type {Map<string, {source: string, importNode: ImportDeclaration}>} */
|