@style-this/core 0.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/README.md +40 -0
- package/dist/compiler.cjs +492 -0
- package/dist/compiler.d.cts +31 -0
- package/dist/compiler.d.cts.map +1 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +16 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region native/pkg/style_this.d.ts
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
declare class Transformer$1 {
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
constructor(opts: any);
|
|
9
|
+
transform(code: string, filepath: string, import_source?: string | null): Promise<any | undefined>;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/compiler.d.ts
|
|
13
|
+
interface Transformer extends Omit<Transformer$1, "transform"> {
|
|
14
|
+
transform(code: string, filepath: string, importSource?: string): Promise<{
|
|
15
|
+
code: string;
|
|
16
|
+
sourcemap: string;
|
|
17
|
+
temporaryPrograms: string[];
|
|
18
|
+
} | undefined>;
|
|
19
|
+
}
|
|
20
|
+
declare const Transformer: new (opts: {
|
|
21
|
+
cwd: string;
|
|
22
|
+
loadFile: (filepath: string, importer: string) => Promise<[string, string]>;
|
|
23
|
+
cssFileStore: Map<string, string>;
|
|
24
|
+
exportCache: Record<string, Record<string, any>>;
|
|
25
|
+
cssExtension: string;
|
|
26
|
+
wrapSelectorsWithGlobal?: boolean;
|
|
27
|
+
}) => Transformer;
|
|
28
|
+
declare const initializeStyleThis: () => Promise<void>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Transformer, initializeStyleThis };
|
|
31
|
+
//# sourceMappingURL=compiler.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.cts","names":["Transformer","Symbol","dispose","Promise","initialize","InitInput","RequestInfo","URL","Response","BufferSource","WebAssembly","Module","InitOutput","Memory","Table","SyncInitInput","initSync","__wbg_init","default"],"sources":["../native/pkg/style_this.d.ts","../src/compiler.ts"],"sourcesContent":["/* tslint:disable */\n/* eslint-disable */\n\nexport class Transformer {\n free(): void;\n [Symbol.dispose](): void;\n constructor(opts: any);\n transform(code: string, filepath: string, import_source?: string | null): Promise<any | undefined>;\n}\n\nexport function initialize(): void;\n\nexport type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;\n\nexport interface InitOutput {\n readonly memory: WebAssembly.Memory;\n readonly __wbg_transformer_free: (a: number, b: number) => void;\n readonly transformer_new: (a: any) => number;\n readonly transformer_transform: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;\n readonly initialize: () => void;\n readonly wasm_bindgen__convert__closures_____invoke__hfe6a4a76b5e0fdbe: (a: number, b: number, c: any) => void;\n readonly wasm_bindgen__closure__destroy__hc2d6b7cd70f3b545: (a: number, b: number) => void;\n readonly wasm_bindgen__convert__closures_____invoke__h3c226b569f92c761: (a: number, b: number, c: any, d: any) => void;\n readonly __wbindgen_malloc: (a: number, b: number) => number;\n readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;\n readonly __wbindgen_exn_store: (a: number) => void;\n readonly __externref_table_alloc: () => number;\n readonly __wbindgen_externrefs: WebAssembly.Table;\n readonly __wbindgen_free: (a: number, b: number, c: number) => void;\n readonly __wbindgen_start: () => void;\n}\n\nexport type SyncInitInput = BufferSource | WebAssembly.Module;\n\n/**\n* Instantiates the given `module`, which can either be bytes or\n* a precompiled `WebAssembly.Module`.\n*\n* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.\n*\n* @returns {InitOutput}\n*/\nexport function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;\n\n/**\n* If `module_or_path` is {RequestInfo} or {URL}, makes a request and\n* for everything else, calls `WebAssembly.instantiate` directly.\n*\n* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.\n*\n* @returns {Promise<InitOutput>}\n*/\nexport default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;\n"],"mappings":";;AAGA;;cAAaA,aAAAA;;ECEb,CDAGC,MAAAA,CAAOC,OAAAA,GCAmB,EAAA,IAAA;EAAa,WAAA,CAAA,IAAA,EAAA,GAAA;EAKrC,SAAA,CAAA,IAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EAAA,MAAA,GAAA,IAAA,CAAA,EDHuEC,OCGvE,CAAA,GAAA,GAAA,SAAA,CAAA;;;;ADPQH,UCEI,WAAA,SAAoB,IDA3BE,CCAgC,aDEkCC,EAAO,WAAA,CAAA,CAAA;oECG9E;;;IALY,iBAAY,EAAA,MAAA,EAAA;EAAa,CAAA,GAAA,SAAA,CAAA;;AAAL,cAgBxB,WAhBwB,EAAA,KAAA,IAAA,EAAA;EAAI,GAAA,EAAA,MAAA;EAgB5B,QAAA,EAAA,CAAA,QAOI,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,GALmC,OAKnC,CAAA,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA;EALmC,YAAA,EACpC,GADoC,CAAA,MAAA,EAAA,MAAA,CAAA;EACpC,WAAA,EACD,MADC,CAAA,MAAA,EACc,MADd,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA;EACc,YAAA,EAAA,MAAA;EAAf,uBAAA,CAAA,EAAA,OAAA;CAGT,EAAA,GAAA,WAAA;AAAW,cAEJ,mBAFI,EAAA,GAAA,GAEe,OAFf,CAAA,IAAA,CAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
2
|
+
type CSSProperties = {
|
|
3
|
+
[key: string]: string | number | CSSProperties;
|
|
4
|
+
};
|
|
5
|
+
type CSS = string & {
|
|
6
|
+
css: string;
|
|
7
|
+
};
|
|
8
|
+
declare const css: (..._raw: any) => CSS;
|
|
9
|
+
declare const style: (s: TemplateStringsArray, ...expr: Array<string | number | CSSProperties>) => string;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { CSSProperties, css, style };
|
|
12
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";KAAY,aAAA;EAAA,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,MAAa,GAAA,MACU,GAAA,aAAa;AAC9C,CAAA;AAMF,KAJK,GAAA,GAQJ,MAAA,GAAA;EAEY,GAAA,EAAA,MAUZ;CATI;AAC8B,cARtB,GAQsB,EAAA,CAAA,GAAA,IAAA,EAAA,GAAA,EAAA,GARA,GAQA;AAAxB,cAFE,KAEF,EAAA,CAAA,CAAA,EADN,oBACM,EAAA,GAAA,IAAA,EAAA,KAAA,CAAA,MAAA,GAAA,MAAA,GAAwB,aAAxB,CAAA,EAAA,GAAA,MAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
const css = (..._raw) => {
|
|
3
|
+
throw new Error("@style-this: called 'css' at runtime. This indicates an error in the transform.");
|
|
4
|
+
};
|
|
5
|
+
const style = (s, ...expr) => {
|
|
6
|
+
let res = "";
|
|
7
|
+
for (let i = 0; i < Math.max(s.length, expr.length); ++i) {
|
|
8
|
+
res += s[i] ?? "";
|
|
9
|
+
res += expr[i] ?? "";
|
|
10
|
+
}
|
|
11
|
+
return res;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { css, style };
|
|
16
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["export type CSSProperties = {\n [key: string]: string | number | CSSProperties;\n};\n\ntype CSS = string & {\n css: string;\n};\n\nexport const css = (..._raw: any): CSS => {\n throw new Error(\n \"@style-this: called 'css' at runtime. This indicates an error in the transform.\",\n );\n};\n\nexport const style = (\n s: TemplateStringsArray,\n ...expr: Array<string | number | CSSProperties>\n): string => {\n let res = \"\";\n for (let i = 0; i < Math.max(s.length, expr.length); ++i) {\n res += s[i] ?? \"\";\n res += expr[i] ?? \"\";\n }\n return res;\n};\n"],"mappings":";AAQA,MAAa,OAAO,GAAG,SAAmB;AACxC,OAAM,IAAI,MACR,kFACD;;AAGH,MAAa,SACX,GACA,GAAG,SACQ;CACX,IAAI,MAAM;AACV,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,IAAI,EAAE,QAAQ,KAAK,OAAO,EAAE,EAAE,GAAG;AACxD,SAAO,EAAE,MAAM;AACf,SAAO,KAAK,MAAM;;AAEpB,QAAO"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@style-this/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CSS-in-JS library for the modern web - core module",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/index.mjs",
|
|
10
|
+
"module": "./dist/index.mjs",
|
|
11
|
+
"types": "./dist/index.d.mts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./dist/index.mjs",
|
|
14
|
+
"./compiler": {
|
|
15
|
+
"require": "./dist/compiler.cjs",
|
|
16
|
+
"types": "./dist/compiler.d.cts",
|
|
17
|
+
"import": "./dist/compiler.cjs",
|
|
18
|
+
"default": "./dist/compiler.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "pnpm build:native && pnpm build:js",
|
|
24
|
+
"build:native": "cd native && wasm-pack build -t web",
|
|
25
|
+
"build:js": "tsdown",
|
|
26
|
+
"dev": "tsdown --watch",
|
|
27
|
+
"lint": "eslint",
|
|
28
|
+
"lint:fix": "pnpm lint --fix",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:watch": "vitest"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@eslint/js": "9.39.1",
|
|
34
|
+
"@vitest/eslint-plugin": "1.4.1",
|
|
35
|
+
"eslint": "9.39.1",
|
|
36
|
+
"tsdown": "0.16.1",
|
|
37
|
+
"typescript-eslint": "8.46.3",
|
|
38
|
+
"vitest": "4.0.8"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@rollup/plugin-wasm": "6.2.2"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|