akanjs 2.0.0-beta.6 → 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/cli/templates/workspaceRoot/biome.json.template +16 -0
- package/devkit/lint/no-deep-internal-import.grit +25 -0
- package/devkit/transforms/barrelImportsPlugin.ts +7 -0
- package/package.json +1 -1
- package/ui/System/SelectLanguage.tsx +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 = (
|
|
@@ -142,6 +142,22 @@
|
|
|
142
142
|
"includes": ["**/*.constant.ts", "**/*.document.ts", "**/*.service.ts", "**/*.store.ts"],
|
|
143
143
|
"plugins": ["./node_modules/akanjs/devkit/lint/no-js-private-class-method.grit"]
|
|
144
144
|
},
|
|
145
|
+
{
|
|
146
|
+
"includes": [
|
|
147
|
+
"**/*.constant.ts",
|
|
148
|
+
"**/*.dictionary.ts",
|
|
149
|
+
"**/*.document.ts",
|
|
150
|
+
"**/*.service.ts",
|
|
151
|
+
"**/*.signal.ts",
|
|
152
|
+
"**/*.store.ts",
|
|
153
|
+
"**/*.Template.tsx",
|
|
154
|
+
"**/*.Unit.tsx",
|
|
155
|
+
"**/*.Util.tsx",
|
|
156
|
+
"**/*.View.tsx",
|
|
157
|
+
"**/*.Zone.tsx"
|
|
158
|
+
],
|
|
159
|
+
"plugins": ["./node_modules/akanjs/devkit/lint/no-deep-internal-import.grit"]
|
|
160
|
+
},
|
|
145
161
|
{
|
|
146
162
|
"includes": [
|
|
147
163
|
"**/page/**/*.ts",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
engine biome(1.0)
|
|
2
|
+
language js(typescript, jsx)
|
|
3
|
+
|
|
4
|
+
or {
|
|
5
|
+
JsModuleSource() as $source where {
|
|
6
|
+
$source <: within JsImport(),
|
|
7
|
+
not $filename <: r".*\.(?:test|spec)\.tsx?",
|
|
8
|
+
$source <: r"\"@(?:apps|libs)/[^/]+/[^/]+/.+\"",
|
|
9
|
+
not $source <: r"\"@apps/[^/]+/env/env\.client\"",
|
|
10
|
+
register_diagnostic(
|
|
11
|
+
span = $source,
|
|
12
|
+
message = "@apps and @libs imports should only reference the first two path segments after the alias."
|
|
13
|
+
)
|
|
14
|
+
},
|
|
15
|
+
JsModuleSource() as $source where {
|
|
16
|
+
$source <: within JsImport(),
|
|
17
|
+
not $filename <: r".*\.(?:test|spec)\.tsx?",
|
|
18
|
+
$filename <: r".*apps/akasys/lib/projectBuild/[^/]+\.(?:constant|dictionary|document|service|signal|store)\.ts|.*apps/akasys/lib/projectBuild/[^/]+\.(?:Template|Unit|Util|View|Zone)\.tsx",
|
|
19
|
+
$source <: r"\"\.\./\.\./.*\"",
|
|
20
|
+
register_diagnostic(
|
|
21
|
+
span = $source,
|
|
22
|
+
message = "projectBuild module files should not import from two or more parent directories."
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -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
|
@@ -22,7 +22,7 @@ export const SelectLanguage = ({ className, languages = parseAkanI18nEnv().local
|
|
|
22
22
|
id="select-language"
|
|
23
23
|
tabIndex={0}
|
|
24
24
|
role="button"
|
|
25
|
-
className="btn btn-ghost btn-sm mx-2 my-auto min-h-0
|
|
25
|
+
className="btn btn-ghost btn-sm mx-2 my-auto min-h-0 border-none px-3 font-medium text-xs md:mx-4"
|
|
26
26
|
>
|
|
27
27
|
{languageNames[lang as keyof typeof languageNames]}
|
|
28
28
|
</div>
|
|
File without changes
|
|
File without changes
|