@akanjs/cli 3.0.0-alpha.12 → 3.0.0-alpha.13

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/.build-stamp CHANGED
@@ -1 +1 @@
1
- 84acd2086ed367dc670ca155f5d5f884d8af105b3527914ac5ba312e3e1985e6
1
+ 0c2560c17e7c39a0ab1a6f08e27af58e63e9598a265c90e5d65e943b82db95c9
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-0wae5ebk.js";
5
5
  import {
6
6
  ApplicationScript
7
- } from "./index-5yjc80ha.js";
7
+ } from "./index-1az48fvn.js";
8
8
  import"./index-8pd02prk.js";
9
9
  import {
10
10
  getMobileTargetChoices
@@ -4,7 +4,7 @@ import {
4
4
  CsrArtifactBuilder,
5
5
  SsrBaseArtifactBuilder,
6
6
  precompressArtifacts
7
- } from "./index-wzdeact3.js";
7
+ } from "./index-2m11t9ek.js";
8
8
  import"./index-xjd3rqzj.js";
9
9
  import"./index-j9cxndc0.js";
10
10
  import"./index-bjpxzr6s.js";
@@ -5,7 +5,7 @@ import {
5
5
  FontOptimizer,
6
6
  PagesBundleBuilder,
7
7
  SsrBaseArtifactBuilder
8
- } from "./index-wzdeact3.js";
8
+ } from "./index-2m11t9ek.js";
9
9
  import"./index-xjd3rqzj.js";
10
10
  import"./index-j9cxndc0.js";
11
11
  import"./index-bjpxzr6s.js";
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import {
3
3
  CloudScript
4
- } from "./index-k8gpsrm1.js";
5
- import"./index-rdv33eye.js";
4
+ } from "./index-xzkynk9f.js";
5
+ import"./index-mt3nkbpt.js";
6
6
  import"./index-h5whaj26.js";
7
7
  import {
8
8
  GlobalConfig
9
9
  } from "./index-0cj2zxbm.js";
10
- import"./index-5yjc80ha.js";
10
+ import"./index-1az48fvn.js";
11
11
  import"./index-8pd02prk.js";
12
12
  import"./index-76rn3g2c.js";
13
13
  import {
@@ -1898,7 +1898,7 @@ function openBrowser(url) {
1898
1898
  }
1899
1899
 
1900
1900
  // pkgs/@akanjs/cli/application/application.runner.ts
1901
- var loadBuildRunner = async () => (await import("./applicationBuildRunner-73kbbb7e.js")).ApplicationBuildRunner;
1901
+ var loadBuildRunner = async () => (await import("./applicationBuildRunner-9ps10a0h.js")).ApplicationBuildRunner;
1902
1902
  var loadReleasePackager = async () => (await import("./applicationReleasePackager-gg8ccbeh.js")).ApplicationReleasePackager;
1903
1903
  var loadCapacitorApp = async () => (await import("./capacitorApp-mr81qdxq.js")).CapacitorApp;
1904
1904
  var loadAbstractCompactor = async () => (await import("./abstractCompactor-e5yq60qz.js")).AbstractCompactor;
@@ -1036,7 +1036,7 @@ class CssCompiler {
1036
1036
  #resolvedFileCache = new Map;
1037
1037
  #resolvedSpecifierCache = new Map;
1038
1038
  #discoveredCssPaths = new Set;
1039
- #importedStylesheets = new Map;
1039
+ importedStylesheetsByBasePath = {};
1040
1040
  #fileExists(absPath) {
1041
1041
  let cached = this.#fileExistsCache.get(absPath);
1042
1042
  if (!cached) {
@@ -1071,8 +1071,11 @@ class CssCompiler {
1071
1071
  if (this.#cssText !== null && !refresh)
1072
1072
  return this.#cssText;
1073
1073
  this.#discoveredCssPaths.clear();
1074
+ this.importedStylesheetsByBasePath = {};
1074
1075
  const { cssPaths, sourcePaths } = await this.discoverCssAndSources({ refresh });
1075
- this.#cssText = await this.compileCss(cssPaths, sourcePaths);
1076
+ const { css, imported } = await this.#compileWithImports(cssPaths, sourcePaths);
1077
+ this.#cssText = css;
1078
+ this.importedStylesheetsByBasePath = { "": imported };
1076
1079
  await this.#warnUnreachableStylesheets();
1077
1080
  return this.#cssText;
1078
1081
  }
@@ -1080,6 +1083,7 @@ class CssCompiler {
1080
1083
  if (this.#cssTextByBasePath !== null && !refresh)
1081
1084
  return this.#cssTextByBasePath;
1082
1085
  this.#discoveredCssPaths.clear();
1086
+ this.importedStylesheetsByBasePath = {};
1083
1087
  const akanConfig = await this.#app.getConfig({ refresh });
1084
1088
  const pageKeys = await this.#app.getPageKeys({ refresh });
1085
1089
  const basePaths = [...akanConfig.basePaths];
@@ -1090,7 +1094,8 @@ class CssCompiler {
1090
1094
  return ["", ""];
1091
1095
  const started = Date.now();
1092
1096
  const { cssPaths, sourcePaths } = await this.discoverCssAndSources({ refresh, pageKeys: rootPageKeys });
1093
- const css = await this.compileCss(cssPaths, sourcePaths);
1097
+ const { css, imported } = await this.#compileWithImports(cssPaths, sourcePaths);
1098
+ this.importedStylesheetsByBasePath[""] = imported;
1094
1099
  this.#logger.verbose(`css base=root paths=${cssPaths.length} sources=${sourcePaths.length} in ${Date.now() - started}ms`);
1095
1100
  return ["", css];
1096
1101
  })(),
@@ -1100,7 +1105,8 @@ class CssCompiler {
1100
1105
  return [basePath, ""];
1101
1106
  const started = Date.now();
1102
1107
  const { cssPaths, sourcePaths } = await this.discoverCssAndSources({ refresh, pageKeys: basePathPageKeys });
1103
- const css = await this.compileCss(cssPaths, sourcePaths);
1108
+ const { css, imported } = await this.#compileWithImports(cssPaths, sourcePaths);
1109
+ this.importedStylesheetsByBasePath[basePath] = imported;
1104
1110
  this.#logger.verbose(`css base=${basePath} paths=${cssPaths.length} sources=${sourcePaths.length} in ${Date.now() - started}ms`);
1105
1111
  return [basePath, css];
1106
1112
  })
@@ -1203,19 +1209,23 @@ class CssCompiler {
1203
1209
  return tokenPaths.filter((tokensPath) => !!tokensPath);
1204
1210
  }
1205
1211
  async compileCss(cssPaths, sourcePaths) {
1212
+ const { css } = await this.#compileWithImports(cssPaths, sourcePaths);
1213
+ return css;
1214
+ }
1215
+ async#compileWithImports(cssPaths, sourcePaths) {
1206
1216
  if (cssPaths.length === 0)
1207
- return "";
1208
- this.#importedStylesheets.clear();
1217
+ return { css: "", imported: [] };
1209
1218
  const compileStarted = Date.now();
1210
1219
  const compilers = await Promise.all(cssPaths.map(async (cssPath) => {
1211
- const css2 = await Bun.file(cssPath).text();
1220
+ const css = await Bun.file(cssPath).text();
1212
1221
  const base = path8.dirname(cssPath);
1213
- const compiler = await compile(css2, {
1222
+ const imported2 = new Map;
1223
+ const compiler = await compile(css, {
1214
1224
  base,
1215
- loadStylesheet: (id, fromBase) => this.#loadStylesheet(id, fromBase),
1225
+ loadStylesheet: (id, fromBase) => this.#loadStylesheet(id, fromBase, imported2),
1216
1226
  loadModule: (id, fromBase) => this.#loadModule(id, fromBase)
1217
1227
  });
1218
- return { cssPath, compiler };
1228
+ return { cssPath, compiler, imported: imported2 };
1219
1229
  }));
1220
1230
  const sourceDirs = new Set;
1221
1231
  for (const entry of compilers) {
@@ -1228,30 +1238,29 @@ class CssCompiler {
1228
1238
  const candidates = await this.#scanCandidates(sourcePaths, [...sourceDirs]);
1229
1239
  this.#logger.verbose(`css candidates scanned count=${candidates.length} sources=${sourcePaths.length} dirs=${sourceDirs.size} in ${Date.now() - scanStarted}ms`);
1230
1240
  const parts = [];
1241
+ const imported = [];
1231
1242
  for (const entry of compilers) {
1232
1243
  if (!entry)
1233
1244
  continue;
1234
- parts.push(entry.compiler.build(candidates));
1245
+ const part = entry.compiler.build(candidates);
1246
+ parts.push(part);
1247
+ for (const [cssPath, content] of entry.imported) {
1248
+ const declaredNames = declaredCustomProperties(content);
1249
+ imported.push({ cssPath, declaredNames });
1250
+ if (declaredNames.length === 0 || declaredNames.some((name) => part.includes(`${name}:`)))
1251
+ continue;
1252
+ this.#logger.warn(`css @import ${cssPath} was loaded by ${entry.cssPath} but none of its ${declaredNames.length} declaration(s) reached the compiled CSS`);
1253
+ }
1235
1254
  }
1236
1255
  this.#logger.verbose(`css compiled paths=${cssPaths.length} candidates=${candidates.length} in ${Date.now() - compileStarted}ms`);
1237
- const css = parts.join(`
1238
- `);
1239
- this.#warnDroppedImports(css);
1240
- return css;
1241
- }
1242
- #warnDroppedImports(css) {
1243
- for (const [cssPath, content] of this.#importedStylesheets) {
1244
- const names = declaredCustomProperties(content);
1245
- if (names.length === 0 || names.some((name) => css.includes(`${name}:`)))
1246
- continue;
1247
- this.#logger.warn(`css @import ${cssPath} was loaded but none of its ${names.length} declaration(s) reached the compiled CSS`);
1248
- }
1256
+ return { css: parts.join(`
1257
+ `), imported };
1249
1258
  }
1250
- async#loadStylesheet(id, fromBase) {
1259
+ async#loadStylesheet(id, fromBase, imported) {
1251
1260
  const p = await this.#resolveCssImport(id, fromBase);
1252
1261
  this.#discoveredCssPaths.add(p);
1253
1262
  const content = await Bun.file(p).text();
1254
- this.#importedStylesheets.set(p, content);
1263
+ imported?.set(p, content);
1255
1264
  this.#logger.verbose(`css import "${id}" from ${fromBase} -> ${p} (${content.length} bytes)`);
1256
1265
  return { path: p, base: path8.dirname(p), content };
1257
1266
  }
@@ -2296,13 +2305,13 @@ class SsrBaseArtifactBuilder {
2296
2305
  `);
2297
2306
  if (!cssText)
2298
2307
  return [];
2299
- return [this.#writeCssAsset(basePath, cssText)];
2308
+ return [this.#writeCssAsset(basePath, cssText, cssCompiler.importedStylesheetsByBasePath[basePath] ?? [])];
2300
2309
  })));
2301
2310
  if (optimizedFonts.files.length > 0)
2302
2311
  this.#app.verbose(`[base-artifact] optimized ${optimizedFonts.files.length} font files`);
2303
2312
  return { cssCompiler, optimizedFonts, cssAssets };
2304
2313
  }
2305
- async#writeCssAsset(basePath, cssText) {
2314
+ async#writeCssAsset(basePath, cssText, imported) {
2306
2315
  const cssAssetName = basePath || "root";
2307
2316
  const preparedCssText = await prepareCssAsset(this.#command, basePath, cssText);
2308
2317
  const cssHash = Bun.hash(`${basePath}
@@ -2312,9 +2321,17 @@ ${preparedCssText}`).toString(36);
2312
2321
  `/_akan/styles/${cssAssetName}-${cssHash}.css`
2313
2322
  ];
2314
2323
  await Bun.write(path13.join(this.#absArtifactDir, cssRelPath), preparedCssText);
2324
+ SsrBaseArtifactBuilder.#warnDroppedImports(this.#app, cssRelPath, preparedCssText, imported);
2315
2325
  this.#app.verbose(`[base-artifact] wrote ${preparedCssText.length} bytes of CSS for ${basePath} -> ${cssRelPath}`);
2316
2326
  return [basePath, { cssUrl, cssRelPath }];
2317
2327
  }
2328
+ static #warnDroppedImports(app, cssRelPath, css, imported) {
2329
+ for (const { cssPath, declaredNames } of imported) {
2330
+ if (declaredNames.length === 0 || declaredNames.some((name) => css.includes(`${name}:`)))
2331
+ continue;
2332
+ app.logger.warn(`[base-artifact] @import ${cssPath} declares ${declaredNames.length} custom propert${declaredNames.length === 1 ? "y" : "ies"} and none of them are in ${cssRelPath}`);
2333
+ }
2334
+ }
2318
2335
  }
2319
2336
  // pkgs/@akanjs/devkit/frontendBuild/styleGuard.ts
2320
2337
  var PREFIX = "(?:bg|text|border(?:-[tblrxy])?(?:-[se])?|ring(?:-offset)?|fill|stroke|shadow|from|to|via|divide|outline|decoration|placeholder|caret|accent)";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-0cj2zxbm.js";
8
8
  import {
9
9
  openBrowser
10
- } from "./index-5yjc80ha.js";
10
+ } from "./index-1az48fvn.js";
11
11
  import {
12
12
  runner
13
13
  } from "./index-etwh7sd3.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  CloudRunner
4
- } from "./index-rdv33eye.js";
4
+ } from "./index-mt3nkbpt.js";
5
5
  import {
6
6
  PackageScript
7
7
  } from "./index-h5whaj26.js";
@@ -12,7 +12,7 @@ import {
12
12
  } from "./index-0cj2zxbm.js";
13
13
  import {
14
14
  ApplicationScript
15
- } from "./index-5yjc80ha.js";
15
+ } from "./index-1az48fvn.js";
16
16
  import {
17
17
  script
18
18
  } from "./index-etwh7sd3.js";
package/index.js CHANGED
@@ -18,16 +18,16 @@ import path from "path";
18
18
 
19
19
  // pkgs/@akanjs/cli/commandModules.ts
20
20
  var commandModules = {
21
- workspace: async () => (await import("./workspace.command-x49ekpkt.js")).WorkspaceCommand,
21
+ workspace: async () => (await import("./workspace.command-bqchx18r.js")).WorkspaceCommand,
22
22
  agent: async () => (await import("./agent.command-a3n15c6t.js")).AgentCommand,
23
- application: async () => (await import("./application.command-rp3y4ejb.js")).ApplicationCommand,
23
+ application: async () => (await import("./application.command-16bzjsam.js")).ApplicationCommand,
24
24
  library: async () => (await import("./library.command-x6t29a30.js")).LibraryCommand,
25
- localRegistry: async () => (await import("./localRegistry.command-f75tqg9w.js")).LocalRegistryCommand,
25
+ localRegistry: async () => (await import("./localRegistry.command-3jssedmy.js")).LocalRegistryCommand,
26
26
  package: async () => (await import("./package.command-zgy7f3fz.js")).PackageCommand,
27
27
  module: async () => (await import("./module.command-8w8ys5t3.js")).ModuleCommand,
28
28
  page: async () => (await import("./page.command-yjmnkyk2.js")).PageCommand,
29
29
  context: async () => (await import("./context.command-ysxawe7h.js")).ContextCommand,
30
- cloud: async () => (await import("./cloud.command-7mcmm52j.js")).CloudCommand,
30
+ cloud: async () => (await import("./cloud.command-f6t115qw.js")).CloudCommand,
31
31
  guideline: async () => (await import("./guideline.command-yqf9a372.js")).GuidelineCommand,
32
32
  scalar: async () => (await import("./scalar.command-9dhmqhtm.js")).ScalarCommand,
33
33
  primitive: async () => (await import("./primitive.command-gfqaagsg.js")).PrimitiveCommand,
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  CloudRunner,
4
4
  getNpmRegistryUrl
5
- } from "./index-rdv33eye.js";
5
+ } from "./index-mt3nkbpt.js";
6
6
  import {
7
7
  PackageScript
8
8
  } from "./index-h5whaj26.js";
9
9
  import"./index-0cj2zxbm.js";
10
10
  import {
11
11
  ApplicationScript
12
- } from "./index-5yjc80ha.js";
12
+ } from "./index-1az48fvn.js";
13
13
  import"./index-8pd02prk.js";
14
14
  import"./index-76rn3g2c.js";
15
15
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "3.0.0-alpha.12",
3
+ "version": "3.0.0-alpha.13",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -34,7 +34,7 @@
34
34
  "@langchain/openai": "^1.4.6",
35
35
  "@tailwindcss/node": "^4.3.0",
36
36
  "@trapezedev/project": "^7.1.4",
37
- "akanjs": "3.0.0-alpha.12",
37
+ "akanjs": "3.0.0-alpha.13",
38
38
  "chalk": "^5.6.2",
39
39
  "commander": "^14.0.3",
40
40
  "dayjs": "^1.11.20",
@@ -11,11 +11,11 @@ import"./index-ss469dec.js";
11
11
  import"./index-65aeh789.js";
12
12
  import {
13
13
  CloudScript
14
- } from "./index-k8gpsrm1.js";
14
+ } from "./index-xzkynk9f.js";
15
15
  import {
16
16
  getLatestPackageVersion,
17
17
  getNpmRegistryUrl
18
- } from "./index-rdv33eye.js";
18
+ } from "./index-mt3nkbpt.js";
19
19
  import {
20
20
  PackageScript
21
21
  } from "./index-h5whaj26.js";
@@ -31,7 +31,7 @@ import"./index-kcsa1zff.js";
31
31
  import"./index-j37qq1f2.js";
32
32
  import {
33
33
  ApplicationScript
34
- } from "./index-5yjc80ha.js";
34
+ } from "./index-1az48fvn.js";
35
35
  import {
36
36
  LibraryScript
37
37
  } from "./index-8pd02prk.js";