@jay-framework/compiler-jay-stack 0.11.0 → 0.13.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/dist/index.js +29 -24
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jayRuntime } from "@jay-framework/vite-plugin";
|
|
2
2
|
import tsBridge from "@jay-framework/typescript-bridge";
|
|
3
3
|
import { flattenVariable, isImportModuleVariableRoot, mkTransformer, SourceFileBindingResolver, areFlattenedAccessChainsEqual } from "@jay-framework/compiler";
|
|
4
|
+
import { getLogger } from "@jay-framework/logger";
|
|
4
5
|
import * as path from "node:path";
|
|
5
6
|
import { createRequire } from "node:module";
|
|
6
7
|
import * as fs from "node:fs";
|
|
@@ -388,7 +389,7 @@ async function transformActionImports(code, id, resolveActionModule) {
|
|
|
388
389
|
for (const imp of actionImports) {
|
|
389
390
|
const resolved = await resolveActionModule(imp.source, id);
|
|
390
391
|
if (!resolved) {
|
|
391
|
-
|
|
392
|
+
getLogger().warn(`[action-transform] Could not resolve action module: ${imp.source}`);
|
|
392
393
|
continue;
|
|
393
394
|
}
|
|
394
395
|
const actions = extractActionsFromSource(resolved.code, resolved.path);
|
|
@@ -401,7 +402,7 @@ async function transformActionImports(code, id, resolveActionModule) {
|
|
|
401
402
|
);
|
|
402
403
|
needsCreateActionCallerImport = true;
|
|
403
404
|
} else {
|
|
404
|
-
|
|
405
|
+
getLogger().warn(
|
|
405
406
|
`[action-transform] Export '${importName}' from ${imp.source} is not a recognized action`
|
|
406
407
|
);
|
|
407
408
|
}
|
|
@@ -505,7 +506,7 @@ function createImportChainTracker(options = {}) {
|
|
|
505
506
|
importChain.clear();
|
|
506
507
|
detectedServerModules.clear();
|
|
507
508
|
if (verbose) {
|
|
508
|
-
|
|
509
|
+
getLogger().info("[import-chain-tracker] Build started, tracking imports...");
|
|
509
510
|
}
|
|
510
511
|
},
|
|
511
512
|
resolveId(source, importer, options2) {
|
|
@@ -517,7 +518,7 @@ function createImportChainTracker(options = {}) {
|
|
|
517
518
|
}
|
|
518
519
|
if (importer) {
|
|
519
520
|
if (verbose) {
|
|
520
|
-
|
|
521
|
+
getLogger().info(
|
|
521
522
|
`[import-chain-tracker] ${shortenPath(importer)} imports ${source}`
|
|
522
523
|
);
|
|
523
524
|
}
|
|
@@ -534,14 +535,14 @@ function createImportChainTracker(options = {}) {
|
|
|
534
535
|
if (isServerOnlyModule(id)) {
|
|
535
536
|
detectedServerModules.add(id);
|
|
536
537
|
const chain = buildImportChain(id);
|
|
537
|
-
|
|
538
|
+
getLogger().error(
|
|
538
539
|
`
|
|
539
540
|
[import-chain-tracker] ⚠️ Server-only module detected in client build!`
|
|
540
541
|
);
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
542
|
+
getLogger().error(`Module: ${shortenPath(id)}`);
|
|
543
|
+
getLogger().error(`Import chain:`);
|
|
544
|
+
getLogger().error(formatChain(chain));
|
|
545
|
+
getLogger().error("");
|
|
545
546
|
}
|
|
546
547
|
const importRegex = /import\s+(?:(?:\{[^}]*\}|[^{}\s,]+)\s+from\s+)?['"]([^'"]+)['"]/g;
|
|
547
548
|
let match;
|
|
@@ -551,16 +552,18 @@ function createImportChainTracker(options = {}) {
|
|
|
551
552
|
if (isServerOnlyModule(importedModule)) {
|
|
552
553
|
if (!detectedServerModules.has(importedModule)) {
|
|
553
554
|
detectedServerModules.add(importedModule);
|
|
554
|
-
|
|
555
|
+
getLogger().error(
|
|
555
556
|
`
|
|
556
557
|
[import-chain-tracker] ⚠️ Server-only import detected in client build!`
|
|
557
558
|
);
|
|
558
|
-
|
|
559
|
+
getLogger().error(
|
|
560
|
+
`Module "${importedModule}" imported by: ${shortenPath(id)}`
|
|
561
|
+
);
|
|
559
562
|
const chain = buildImportChain(id);
|
|
560
563
|
chain.push(importedModule);
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
+
getLogger().error(`Import chain:`);
|
|
565
|
+
getLogger().error(formatChain(chain));
|
|
566
|
+
getLogger().error("");
|
|
564
567
|
}
|
|
565
568
|
}
|
|
566
569
|
}
|
|
@@ -568,21 +571,21 @@ function createImportChainTracker(options = {}) {
|
|
|
568
571
|
},
|
|
569
572
|
buildEnd() {
|
|
570
573
|
if (detectedServerModules.size > 0) {
|
|
571
|
-
|
|
574
|
+
getLogger().warn(
|
|
572
575
|
`
|
|
573
576
|
[import-chain-tracker] ⚠️ ${detectedServerModules.size} server-only module(s) detected during transform:`
|
|
574
577
|
);
|
|
575
578
|
for (const mod of detectedServerModules) {
|
|
576
|
-
|
|
579
|
+
getLogger().warn(` - ${mod}`);
|
|
577
580
|
}
|
|
578
|
-
|
|
581
|
+
getLogger().warn(
|
|
579
582
|
"\nNote: These may be stripped by the code-split transform if only used in .withServer()."
|
|
580
583
|
);
|
|
581
|
-
|
|
584
|
+
getLogger().warn(
|
|
582
585
|
'If build fails with "not exported" errors, check the import chains above.\n'
|
|
583
586
|
);
|
|
584
587
|
} else if (verbose) {
|
|
585
|
-
|
|
588
|
+
getLogger().info(
|
|
586
589
|
"[import-chain-tracker] ✅ No server-only modules detected in client build"
|
|
587
590
|
);
|
|
588
591
|
}
|
|
@@ -649,7 +652,7 @@ function transformImports(options) {
|
|
|
649
652
|
hasChanges = true;
|
|
650
653
|
const newSource = `${packageName}/client`;
|
|
651
654
|
if (verbose) {
|
|
652
|
-
|
|
655
|
+
getLogger().info(
|
|
653
656
|
`[plugin-client-import] Rewriting import ${source} -> ${newSource} (in ${path.basename(filePath)})`
|
|
654
657
|
);
|
|
655
658
|
}
|
|
@@ -666,7 +669,7 @@ function transformImports(options) {
|
|
|
666
669
|
hasChanges = true;
|
|
667
670
|
const newSource = `${packageName}/client`;
|
|
668
671
|
if (verbose) {
|
|
669
|
-
|
|
672
|
+
getLogger().info(
|
|
670
673
|
`[plugin-client-import] Rewriting export ${source} -> ${newSource} (in ${path.basename(filePath)})`
|
|
671
674
|
);
|
|
672
675
|
}
|
|
@@ -742,7 +745,7 @@ function jayStackCompiler(options = {}) {
|
|
|
742
745
|
try {
|
|
743
746
|
return transformJayStackBuilder(code, id, environment);
|
|
744
747
|
} catch (error) {
|
|
745
|
-
|
|
748
|
+
getLogger().error(`[jay-stack:code-split] Error transforming ${id}: ${error}`);
|
|
746
749
|
return null;
|
|
747
750
|
}
|
|
748
751
|
}
|
|
@@ -802,12 +805,14 @@ function jayStackCompiler(options = {}) {
|
|
|
802
805
|
try {
|
|
803
806
|
code = await fs.promises.readFile(actualPath, "utf-8");
|
|
804
807
|
} catch (err) {
|
|
805
|
-
|
|
808
|
+
getLogger().error(
|
|
809
|
+
`[action-transform] Could not read ${actualPath}: ${err}`
|
|
810
|
+
);
|
|
806
811
|
return null;
|
|
807
812
|
}
|
|
808
813
|
const actions = extractActionsFromSource(code, actualPath);
|
|
809
814
|
if (actions.length === 0) {
|
|
810
|
-
|
|
815
|
+
getLogger().warn(`[action-transform] No actions found in ${actualPath}`);
|
|
811
816
|
return null;
|
|
812
817
|
}
|
|
813
818
|
const lines = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/compiler-jay-stack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,15 +27,16 @@
|
|
|
27
27
|
"test:watch": "vitest"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@jay-framework/compiler": "^0.
|
|
31
|
-
"@jay-framework/compiler-shared": "^0.
|
|
32
|
-
"@jay-framework/
|
|
33
|
-
"@jay-framework/
|
|
30
|
+
"@jay-framework/compiler": "^0.13.0",
|
|
31
|
+
"@jay-framework/compiler-shared": "^0.13.0",
|
|
32
|
+
"@jay-framework/logger": "^0.13.0",
|
|
33
|
+
"@jay-framework/typescript-bridge": "^0.8.0",
|
|
34
|
+
"@jay-framework/vite-plugin": "^0.13.0",
|
|
34
35
|
"typescript": "^5.3.3",
|
|
35
36
|
"vite": "^5.0.11"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
|
-
"@jay-framework/dev-environment": "^0.
|
|
39
|
+
"@jay-framework/dev-environment": "^0.13.0",
|
|
39
40
|
"rimraf": "^5.0.5",
|
|
40
41
|
"tsup": "^8.0.1",
|
|
41
42
|
"vitest": "^1.2.1"
|