akanjs 2.0.0-beta.7 → 2.0.0-beta.8
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/cli/index.js +4 -0
- package/cli/templates/app/page/_layout.tsx +0 -1
- package/devkit/transforms/barrelImportsPlugin.ts +7 -0
- package/package.json +1 -1
- /package/cli/templates/app/public/{favicon.ico → favicon.ico.template} +0 -0
- /package/cli/templates/app/public/{logo.png → logo.png.template} +0 -0
package/cli/index.js
CHANGED
|
@@ -4816,6 +4816,9 @@ var rewriteSingleStatement = (stmt, map) => {
|
|
|
4816
4816
|
return null;
|
|
4817
4817
|
const lines = [];
|
|
4818
4818
|
const tail = ";";
|
|
4819
|
+
if (shouldPreserveBarrelSideEffects(stmt.specifier)) {
|
|
4820
|
+
lines.push(`import "${stmt.specifier}"${tail}`);
|
|
4821
|
+
}
|
|
4819
4822
|
if (clause.defaultImport || remaining.length > 0) {
|
|
4820
4823
|
const parts = [];
|
|
4821
4824
|
if (clause.defaultImport)
|
|
@@ -4831,6 +4834,7 @@ var rewriteSingleStatement = (stmt, map) => {
|
|
|
4831
4834
|
return lines.join(`
|
|
4832
4835
|
`);
|
|
4833
4836
|
};
|
|
4837
|
+
var shouldPreserveBarrelSideEffects = (specifier) => /^@(apps|libs)\/[^/]+\/client$/.test(specifier);
|
|
4834
4838
|
var serializeNamedItem = (item) => {
|
|
4835
4839
|
const prefix = item.isType ? "type " : "";
|
|
4836
4840
|
if (item.imported === item.local)
|
|
@@ -10,7 +10,6 @@ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dic
|
|
|
10
10
|
content: `
|
|
11
11
|
import "./styles.css";
|
|
12
12
|
import type { LayoutProps } from "akanjs/client";
|
|
13
|
-
import { fetch } from "@${dict.appName}/client";
|
|
14
13
|
${isUsingShared ? "import { Auth } from '@shared/ui';" : ""}
|
|
15
14
|
|
|
16
15
|
export const head = (
|
|
@@ -421,6 +421,10 @@ const rewriteSingleStatement = (stmt: ImportStatement, map: BarrelExportMap): st
|
|
|
421
421
|
|
|
422
422
|
const tail = ";";
|
|
423
423
|
|
|
424
|
+
if (shouldPreserveBarrelSideEffects(stmt.specifier)) {
|
|
425
|
+
lines.push(`import "${stmt.specifier}"${tail}`);
|
|
426
|
+
}
|
|
427
|
+
|
|
424
428
|
if (clause.defaultImport || remaining.length > 0) {
|
|
425
429
|
const parts: string[] = [];
|
|
426
430
|
if (clause.defaultImport) parts.push(clause.defaultImport);
|
|
@@ -437,6 +441,9 @@ const rewriteSingleStatement = (stmt: ImportStatement, map: BarrelExportMap): st
|
|
|
437
441
|
return lines.join("\n");
|
|
438
442
|
};
|
|
439
443
|
|
|
444
|
+
const shouldPreserveBarrelSideEffects = (specifier: string): boolean =>
|
|
445
|
+
/^@(apps|libs)\/[^/]+\/client$/.test(specifier);
|
|
446
|
+
|
|
440
447
|
const serializeNamedItem = (item: NamedImportItem): string => {
|
|
441
448
|
const prefix = item.isType ? "type " : "";
|
|
442
449
|
if (item.imported === item.local) return `${prefix}${item.imported}`;
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|