@akanjs/devkit 0.0.149 → 0.0.151

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.
@@ -34,6 +34,8 @@ var esbuild = __toESM(require("esbuild"));
34
34
  var import_esbuild_plugin_d = require("esbuild-plugin-d.ts");
35
35
  var import_fs = __toESM(require("fs"));
36
36
  var import_extractDeps = require("./extractDeps");
37
+ const assetExtensions = [".css", ".md", ".js", ".png", ".ico", ".svg", ".json", ".template"];
38
+ const assetLoader = Object.fromEntries(assetExtensions.map((ext) => [ext, "copy"]));
37
39
  class Builder {
38
40
  #executor;
39
41
  #distExecutor;
@@ -58,7 +60,7 @@ class Builder {
58
60
  format,
59
61
  outdir: `${this.#distExecutor.cwdPath}/${format}`,
60
62
  logLevel: "error",
61
- loader: { ".template": "copy", ".md": "copy" }
63
+ loader: assetLoader
62
64
  };
63
65
  }
64
66
  #getAssetBuildOptions() {
@@ -72,7 +74,7 @@ class Builder {
72
74
  ],
73
75
  outdir: this.#distExecutor.cwdPath,
74
76
  logLevel: "error",
75
- loader: { ".css": "copy", ".md": "copy", ".js": "copy" }
77
+ loader: assetLoader
76
78
  };
77
79
  }
78
80
  async build(options = {}) {
@@ -307,11 +307,12 @@ class Executor {
307
307
  dict = {},
308
308
  overwrite = true
309
309
  }) {
310
- const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`.replace(".ts", ".js");
311
- if (import_fs.default.statSync(templatePath).isFile()) {
312
- const filename = import_path.default.basename(templatePath);
310
+ const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`;
311
+ const prefixTemplatePath = templatePath.endsWith(".tsx") ? templatePath : templatePath.replace(".ts", ".js");
312
+ if (import_fs.default.statSync(prefixTemplatePath).isFile()) {
313
+ const filename = import_path.default.basename(prefixTemplatePath);
313
314
  const fileContent = await this.#applyTemplateFile(
314
- { templatePath, targetPath: import_path.default.join(basePath, filename), scanResult, overwrite },
315
+ { templatePath: prefixTemplatePath, targetPath: import_path.default.join(basePath, filename), scanResult, overwrite },
315
316
  dict
316
317
  );
317
318
  return fileContent ? [fileContent] : [];
@@ -2,6 +2,8 @@ import * as esbuild from "esbuild";
2
2
  import { dtsPlugin } from "esbuild-plugin-d.ts";
3
3
  import fs from "fs";
4
4
  import { extractDependencies } from "./extractDeps";
5
+ const assetExtensions = [".css", ".md", ".js", ".png", ".ico", ".svg", ".json", ".template"];
6
+ const assetLoader = Object.fromEntries(assetExtensions.map((ext) => [ext, "copy"]));
5
7
  class Builder {
6
8
  #executor;
7
9
  #distExecutor;
@@ -26,7 +28,7 @@ class Builder {
26
28
  format,
27
29
  outdir: `${this.#distExecutor.cwdPath}/${format}`,
28
30
  logLevel: "error",
29
- loader: { ".template": "copy", ".md": "copy" }
31
+ loader: assetLoader
30
32
  };
31
33
  }
32
34
  #getAssetBuildOptions() {
@@ -40,7 +42,7 @@ class Builder {
40
42
  ],
41
43
  outdir: this.#distExecutor.cwdPath,
42
44
  logLevel: "error",
43
- loader: { ".css": "copy", ".md": "copy", ".js": "copy" }
45
+ loader: assetLoader
44
46
  };
45
47
  }
46
48
  async build(options = {}) {
@@ -272,11 +272,12 @@ class Executor {
272
272
  dict = {},
273
273
  overwrite = true
274
274
  }) {
275
- const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`.replace(".ts", ".js");
276
- if (fs.statSync(templatePath).isFile()) {
277
- const filename = path.basename(templatePath);
275
+ const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`;
276
+ const prefixTemplatePath = templatePath.endsWith(".tsx") ? templatePath : templatePath.replace(".ts", ".js");
277
+ if (fs.statSync(prefixTemplatePath).isFile()) {
278
+ const filename = path.basename(prefixTemplatePath);
278
279
  const fileContent = await this.#applyTemplateFile(
279
- { templatePath, targetPath: path.join(basePath, filename), scanResult, overwrite },
280
+ { templatePath: prefixTemplatePath, targetPath: path.join(basePath, filename), scanResult, overwrite },
280
281
  dict
281
282
  );
282
283
  return fileContent ? [fileContent] : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/devkit",
3
- "version": "0.0.149",
3
+ "version": "0.0.151",
4
4
  "sourceType": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"