@styleframe/transpiler 1.0.2 → 1.0.3

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/transpiler.d.ts +120 -0
  3. package/dist/transpiler.js +432 -0
  4. package/dist/transpiler.umd.cjs +14 -0
  5. package/package.json +8 -2
  6. package/.tsbuildinfo +0 -1
  7. package/src/constants.ts +0 -4
  8. package/src/consume/at-rule.test.ts +0 -339
  9. package/src/consume/at-rule.ts +0 -34
  10. package/src/consume/consume.test.ts +0 -259
  11. package/src/consume/consume.ts +0 -81
  12. package/src/consume/container.test.ts +0 -501
  13. package/src/consume/container.ts +0 -73
  14. package/src/consume/css.test.ts +0 -187
  15. package/src/consume/css.ts +0 -17
  16. package/src/consume/declarations.test.ts +0 -210
  17. package/src/consume/declarations.ts +0 -17
  18. package/src/consume/index.ts +0 -12
  19. package/src/consume/primitive.test.ts +0 -52
  20. package/src/consume/primitive.ts +0 -16
  21. package/src/consume/ref.test.ts +0 -84
  22. package/src/consume/ref.ts +0 -22
  23. package/src/consume/root.test.ts +0 -353
  24. package/src/consume/root.ts +0 -19
  25. package/src/consume/selector.test.ts +0 -441
  26. package/src/consume/selector.ts +0 -17
  27. package/src/consume/theme.test.ts +0 -215
  28. package/src/consume/theme.ts +0 -15
  29. package/src/consume/utility.test.ts +0 -696
  30. package/src/consume/utility.ts +0 -31
  31. package/src/consume/variable.test.ts +0 -197
  32. package/src/consume/variable.ts +0 -20
  33. package/src/defaults.ts +0 -21
  34. package/src/generator/genAtRuleQuery.test.ts +0 -148
  35. package/src/generator/genAtRuleQuery.ts +0 -3
  36. package/src/generator/genDeclaration.test.ts +0 -283
  37. package/src/generator/genDeclaration.ts +0 -9
  38. package/src/generator/genDeclarationsBlock.test.ts +0 -278
  39. package/src/generator/genDeclarationsBlock.ts +0 -7
  40. package/src/generator/genDeclareVariable.test.ts +0 -323
  41. package/src/generator/genDeclareVariable.ts +0 -6
  42. package/src/generator/genInlineAtRule.test.ts +0 -351
  43. package/src/generator/genInlineAtRule.ts +0 -5
  44. package/src/generator/genReferenceVariable.test.ts +0 -392
  45. package/src/generator/genReferenceVariable.ts +0 -5
  46. package/src/generator/genSafePropertyName.test.ts +0 -489
  47. package/src/generator/genSafePropertyName.ts +0 -5
  48. package/src/generator/genSafeVariableName.test.ts +0 -358
  49. package/src/generator/genSafeVariableName.ts +0 -21
  50. package/src/generator/genSelector.test.ts +0 -357
  51. package/src/generator/genSelector.ts +0 -5
  52. package/src/generator/index.ts +0 -9
  53. package/src/index.ts +0 -6
  54. package/src/transpile.test.ts +0 -829
  55. package/src/transpile.ts +0 -34
  56. package/src/types.ts +0 -23
  57. package/src/utils.ts +0 -18
  58. package/src/vite-env.d.ts +0 -1
  59. package/tsconfig.json +0 -7
  60. package/vite.config.ts +0 -5
package/src/transpile.ts DELETED
@@ -1,34 +0,0 @@
1
- import type { Styleframe } from "@styleframe/core";
2
- import { consumeCSS, consumeTS } from "./consume";
3
- import type { Output, OutputFile, TranspileOptions } from "./types";
4
-
5
- export function createFile(name: string, content: string = ""): OutputFile {
6
- return {
7
- name,
8
- content,
9
- };
10
- }
11
-
12
- export function transpile(
13
- instance: Styleframe,
14
- {
15
- type = "all",
16
- consumers = { css: consumeCSS, ts: consumeTS },
17
- }: TranspileOptions = {},
18
- ): Output {
19
- const output: Output = { files: [] };
20
- const options = instance.options;
21
- const { recipes, ...root } = instance.root;
22
-
23
- if (type === "all" || type === "css") {
24
- const indexFile = createFile("index.css", consumers.css(root, options));
25
- output.files.push(indexFile);
26
- }
27
-
28
- if (type === "all" || type === "ts") {
29
- const indexFile = createFile("index.ts", consumers.ts([], options));
30
- output.files.push(indexFile);
31
- }
32
-
33
- return output;
34
- }
package/src/types.ts DELETED
@@ -1,23 +0,0 @@
1
- import type { StyleframeOptions } from "@styleframe/core";
2
-
3
- export type OutputFile = {
4
- name: string;
5
- content: string;
6
- };
7
-
8
- export type Output = {
9
- files: OutputFile[];
10
- };
11
-
12
- export type ConsumeFunction = (
13
- instance: unknown,
14
- options: StyleframeOptions,
15
- ) => string;
16
-
17
- export type TranspileOptions = {
18
- type?: "css" | "ts" | "all";
19
- consumers?: {
20
- css: ConsumeFunction;
21
- ts: ConsumeFunction;
22
- };
23
- };
package/src/utils.ts DELETED
@@ -1,18 +0,0 @@
1
- import { DEFAULT_INDENT } from "./constants";
2
- import { kebabCase } from "scule";
3
- import type { KebabCase } from "scule";
4
-
5
- export function addIndentToLine(line: string): string {
6
- return `${DEFAULT_INDENT}${line}`;
7
- }
8
-
9
- export function indentLines(lines: string): string {
10
- return lines
11
- .split("\n")
12
- .map((line) => addIndentToLine(line))
13
- .join("\n");
14
- }
15
-
16
- export function toKebabCase<S extends string>(str: S): KebabCase<S> {
17
- return kebabCase(str);
18
- }
package/src/vite-env.d.ts DELETED
@@ -1 +0,0 @@
1
- /// <reference types="vite/client" />
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "@styleframe/config-typescript",
3
- "compilerOptions": {
4
- "tsBuildInfoFile": ".tsbuildinfo"
5
- },
6
- "include": ["src/**/*.ts", "tsdown.config.ts", "vite.config.ts"]
7
- }
package/vite.config.ts DELETED
@@ -1,5 +0,0 @@
1
- import { createViteConfig } from "@styleframe/config-vite";
2
-
3
- const __dirname = new URL(".", import.meta.url).pathname;
4
-
5
- export default createViteConfig("transpiler", __dirname);