@styleframe/loader 1.0.2 → 1.1.0
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/CHANGELOG.md +22 -0
- package/dist/index.cjs +996 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +996 -0
- package/package.json +14 -7
- package/.tsbuildinfo +0 -1
- package/playground/build.ts +0 -13
- package/playground/load.ts +0 -9
- package/playground/styleframe.config.ts +0 -50
- package/playground/watch.ts +0 -9
- package/src/build.ts +0 -36
- package/src/config.ts +0 -45
- package/src/index.ts +0 -3
- package/src/utils.ts +0 -10
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -12
- package/vite.config.ts +0 -13
package/src/config.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Styleframe } from "@styleframe/core";
|
|
2
|
-
import { styleframe } from "@styleframe/core";
|
|
3
|
-
import { loadConfig, watchConfig } from "c12";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
|
|
6
|
-
export async function loadConfiguration({
|
|
7
|
-
cwd = process.cwd(),
|
|
8
|
-
name = "styleframe",
|
|
9
|
-
}: {
|
|
10
|
-
cwd?: string;
|
|
11
|
-
name?: string;
|
|
12
|
-
} = {}) {
|
|
13
|
-
const { config } = await loadConfig<Styleframe>({
|
|
14
|
-
cwd,
|
|
15
|
-
name,
|
|
16
|
-
defaults: styleframe(),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return config;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export async function loadConfigurationFromPath(entry: string) {
|
|
23
|
-
const entryPath = path.resolve(entry);
|
|
24
|
-
const cwd = path.dirname(entryPath);
|
|
25
|
-
const name = path.basename(entryPath).replace(/(\.config)?(\.ts)?$/, "");
|
|
26
|
-
|
|
27
|
-
return await loadConfiguration({ cwd, name });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export async function watchConfiguration({
|
|
31
|
-
cwd = process.cwd(),
|
|
32
|
-
}: {
|
|
33
|
-
cwd?: string;
|
|
34
|
-
} = {}) {
|
|
35
|
-
return await watchConfig<Styleframe>({
|
|
36
|
-
cwd,
|
|
37
|
-
name: "styleframe",
|
|
38
|
-
acceptHMR({ getDiff }) {
|
|
39
|
-
const diff = getDiff();
|
|
40
|
-
if (diff.length === 0) {
|
|
41
|
-
return true; // No changes!
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
}
|
package/src/index.ts
DELETED
package/src/utils.ts
DELETED
package/src/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
package/tsconfig.json
DELETED
package/vite.config.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createViteConfig } from "@styleframe/config-vite";
|
|
2
|
-
import { VitePluginNode } from "vite-plugin-node";
|
|
3
|
-
|
|
4
|
-
const __dirname = new URL(".", import.meta.url).pathname;
|
|
5
|
-
|
|
6
|
-
export default createViteConfig("loader", __dirname, {
|
|
7
|
-
plugins: [
|
|
8
|
-
VitePluginNode({
|
|
9
|
-
appPath: "./src/index.ts",
|
|
10
|
-
adapter: "express",
|
|
11
|
-
}),
|
|
12
|
-
],
|
|
13
|
-
});
|