@sealcode/sealgen 0.16.1-beta → 0.16.1-beta3

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/lib/CSSBuilder.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { build } from "esbuild";
2
- import { resolve, relative, basename } from "node:path";
2
+ import { resolve, relative, basename, dirname } from "node:path";
3
3
  import glob from "tiny-glob";
4
4
  import { promises as fs } from "fs";
5
5
  import { walkDir } from "./utils/walk.js";
@@ -46,16 +46,21 @@ class CSSClump {
46
46
  );
47
47
  }
48
48
  getEntrypointPath() {
49
- return resolve(this.project_dir, `src/${this.name}.entrypoint.css`);
49
+ return resolve(
50
+ this.project_dir,
51
+ `src/style-entrypoints/${this.name}.entrypoint.css`
52
+ );
50
53
  }
51
54
  async makeEntrypoint() {
55
+ const entrypoint_path = this.getEntrypointPath();
56
+ await fs.mkdir(dirname(entrypoint_path), { recursive: true });
52
57
  await fs.writeFile(
53
- this.getEntrypointPath(),
58
+ entrypoint_path,
54
59
  [
55
60
  `/* DO NOT EDIT! Automatically generated by sealgen */`,
56
61
  ...this.files.sort().map(
57
62
  (fullpath) => `@import "${relative(
58
- resolve(this.project_dir, `src`),
63
+ dirname(entrypoint_path),
59
64
  fullpath
60
65
  )}";`
61
66
  )
@@ -67,7 +72,17 @@ class CSSClump {
67
72
  segments.shift();
68
73
  segments.pop();
69
74
  if (!segments.length) {
70
- return ["default"];
75
+ if (file_path.includes("/jdd-components/")) {
76
+ const component_name = file_path.match(
77
+ /jdd-components\/([^/]+)\//
78
+ )?.[1];
79
+ if (!component_name) {
80
+ return [];
81
+ }
82
+ return ["jdd-components", "jdd-component__" + component_name];
83
+ } else {
84
+ return ["default"];
85
+ }
71
86
  }
72
87
  if (segments.length == 1 && segments[0] == "entrypoint") {
73
88
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealcode/sealgen",
3
- "version": "0.16.1-beta",
3
+ "version": "0.16.1-beta3",
4
4
  "description": "Module to automate adding routes and collections to a sealious application",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
package/src/CSSBuilder.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { build } from "esbuild";
2
- import { resolve, relative, basename } from "node:path";
2
+ import { resolve, relative, basename, dirname } from "node:path";
3
3
  import glob from "tiny-glob";
4
4
  import { promises as fs } from "fs";
5
5
  import { walkDir } from "./utils/walk.js";
6
6
  import { Builder } from "./builder.js";
7
- import { sleep } from "./utils/sleep.js";
8
7
 
9
8
  export class CSSClump {
10
9
  public files: string[] = [];
@@ -51,12 +50,17 @@ export class CSSClump {
51
50
  }
52
51
 
53
52
  getEntrypointPath(): string {
54
- return resolve(this.project_dir, `src/${this.name}.entrypoint.css`);
53
+ return resolve(
54
+ this.project_dir,
55
+ `src/style-entrypoints/${this.name}.entrypoint.css`
56
+ );
55
57
  }
56
58
 
57
59
  async makeEntrypoint() {
60
+ const entrypoint_path = this.getEntrypointPath();
61
+ await fs.mkdir(dirname(entrypoint_path), { recursive: true });
58
62
  await fs.writeFile(
59
- this.getEntrypointPath(),
63
+ entrypoint_path,
60
64
  [
61
65
  `/* DO NOT EDIT! Automatically generated by sealgen */`,
62
66
  ...this.files
@@ -64,7 +68,7 @@ export class CSSClump {
64
68
  .map(
65
69
  (fullpath) =>
66
70
  `@import "${relative(
67
- resolve(this.project_dir, `src`),
71
+ dirname(entrypoint_path),
68
72
  fullpath
69
73
  )}";`
70
74
  ),
@@ -77,8 +81,18 @@ export class CSSClump {
77
81
  segments.shift(); // filename
78
82
  segments.pop(); // extension
79
83
  if (!segments.length) {
80
- // no segments, default clump
81
- return ["default"];
84
+ if (file_path.includes("/jdd-components/")) {
85
+ const component_name = file_path.match(
86
+ /jdd-components\/([^/]+)\//
87
+ )?.[1];
88
+ if (!component_name) {
89
+ return [];
90
+ }
91
+ return ["jdd-components", "jdd-component__" + component_name];
92
+ } else {
93
+ // no segments, default clump
94
+ return ["default"];
95
+ }
82
96
  }
83
97
  if (segments.length == 1 && segments[0] == "entrypoint") {
84
98
  return [];