@wyw-in-js/shared 1.1.0 → 2.0.0-alpha.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.
Files changed (75) hide show
  1. package/esm/IVariableContext.js +1 -1
  2. package/esm/IVariableContext.js.map +1 -1
  3. package/esm/asyncResolveFallback.js +35 -31
  4. package/esm/asyncResolveFallback.js.map +1 -1
  5. package/esm/asyncResolverFactory.js +9 -9
  6. package/esm/asyncResolverFactory.js.map +1 -1
  7. package/esm/debugger.js +1 -1
  8. package/esm/debugger.js.map +1 -1
  9. package/esm/findPackageJSON.js +60 -68
  10. package/esm/findPackageJSON.js.map +1 -1
  11. package/esm/hasEvalMeta.js +2 -2
  12. package/esm/hasEvalMeta.js.map +1 -1
  13. package/esm/index.js +10 -10
  14. package/esm/index.js.map +1 -1
  15. package/esm/isBoxedPrimitive.js +4 -5
  16. package/esm/isBoxedPrimitive.js.map +1 -1
  17. package/esm/logger.js +17 -17
  18. package/esm/logger.js.map +1 -1
  19. package/esm/options/isFeatureEnabled.js +22 -27
  20. package/esm/options/isFeatureEnabled.js.map +1 -1
  21. package/esm/options/types.js +1 -1
  22. package/esm/options/types.js.map +1 -1
  23. package/esm/slugify.js +47 -49
  24. package/esm/slugify.js.map +1 -1
  25. package/esm/types.js +6 -10
  26. package/esm/types.js.map +1 -1
  27. package/package.json +12 -10
  28. package/types/IVariableContext.js +1 -2
  29. package/types/asyncResolveFallback.js +8 -14
  30. package/types/asyncResolverFactory.js +1 -5
  31. package/types/debugger.js +1 -2
  32. package/types/findPackageJSON.js +13 -17
  33. package/types/hasEvalMeta.js +1 -4
  34. package/types/index.d.ts +2 -2
  35. package/types/index.js +9 -23
  36. package/types/isBoxedPrimitive.js +1 -4
  37. package/types/logger.js +7 -14
  38. package/types/options/isFeatureEnabled.js +3 -7
  39. package/types/options/types.d.ts +78 -8
  40. package/types/options/types.js +1 -2
  41. package/types/slugify.js +1 -4
  42. package/types/types.d.ts +40 -1
  43. package/types/types.js +2 -5
  44. package/esm/babel.js +0 -2
  45. package/esm/babel.js.map +0 -1
  46. package/lib/IVariableContext.js +0 -2
  47. package/lib/IVariableContext.js.map +0 -1
  48. package/lib/asyncResolveFallback.js +0 -47
  49. package/lib/asyncResolveFallback.js.map +0 -1
  50. package/lib/asyncResolverFactory.js +0 -18
  51. package/lib/asyncResolverFactory.js.map +0 -1
  52. package/lib/babel.js +0 -2
  53. package/lib/babel.js.map +0 -1
  54. package/lib/debugger.js +0 -2
  55. package/lib/debugger.js.map +0 -1
  56. package/lib/findPackageJSON.js +0 -81
  57. package/lib/findPackageJSON.js.map +0 -1
  58. package/lib/hasEvalMeta.js +0 -10
  59. package/lib/hasEvalMeta.js.map +0 -1
  60. package/lib/index.js +0 -81
  61. package/lib/index.js.map +0 -1
  62. package/lib/isBoxedPrimitive.js +0 -15
  63. package/lib/isBoxedPrimitive.js.map +0 -1
  64. package/lib/logger.js +0 -35
  65. package/lib/logger.js.map +0 -1
  66. package/lib/options/isFeatureEnabled.js +0 -37
  67. package/lib/options/isFeatureEnabled.js.map +0 -1
  68. package/lib/options/types.js +0 -2
  69. package/lib/options/types.js.map +0 -1
  70. package/lib/slugify.js +0 -68
  71. package/lib/slugify.js.map +0 -1
  72. package/lib/types.js +0 -16
  73. package/lib/types.js.map +0 -1
  74. package/types/babel.d.ts +0 -2
  75. package/types/babel.js +0 -2
package/esm/slugify.js CHANGED
@@ -1,62 +1,60 @@
1
1
  /* eslint-disable no-plusplus, no-bitwise, default-case, no-param-reassign, prefer-destructuring */
2
2
  /**
3
- * This file contains a utility to generate hashes to be used as generated class names
4
- */
5
-
3
+ * This file contains a utility to generate hashes to be used as generated class names
4
+ */
6
5
  /**
7
- * murmurhash2 via https://gist.github.com/raycmorgan/588423
8
- */
9
-
6
+ * murmurhash2 via https://gist.github.com/raycmorgan/588423
7
+ */
10
8
  function UInt32(str, pos) {
11
- return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8) + (str.charCodeAt(pos++) << 16) + (str.charCodeAt(pos) << 24);
9
+ return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8) + (str.charCodeAt(pos++) << 16) + (str.charCodeAt(pos) << 24);
12
10
  }
13
11
  function UInt16(str, pos) {
14
- return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8);
12
+ return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8);
15
13
  }
16
14
  function Umul32(n, m) {
17
- n |= 0;
18
- m |= 0;
19
- const nlo = n & 0xffff;
20
- const nhi = n >>> 16;
21
- return nlo * m + ((nhi * m & 0xffff) << 16) | 0;
15
+ n |= 0;
16
+ m |= 0;
17
+ const nlo = n & 65535;
18
+ const nhi = n >>> 16;
19
+ return nlo * m + ((nhi * m & 65535) << 16) | 0;
22
20
  }
23
21
  function doHash(str, seed = 0) {
24
- const m = 0x5bd1e995;
25
- const r = 24;
26
- let h = seed ^ str.length;
27
- let length = str.length;
28
- let currentIndex = 0;
29
- while (length >= 4) {
30
- let k = UInt32(str, currentIndex);
31
- k = Umul32(k, m);
32
- k ^= k >>> r;
33
- k = Umul32(k, m);
34
- h = Umul32(h, m);
35
- h ^= k;
36
- currentIndex += 4;
37
- length -= 4;
38
- }
39
- switch (length) {
40
- case 3:
41
- h ^= UInt16(str, currentIndex);
42
- h ^= str.charCodeAt(currentIndex + 2) << 16;
43
- h = Umul32(h, m);
44
- break;
45
- case 2:
46
- h ^= UInt16(str, currentIndex);
47
- h = Umul32(h, m);
48
- break;
49
- case 1:
50
- h ^= str.charCodeAt(currentIndex);
51
- h = Umul32(h, m);
52
- break;
53
- }
54
- h ^= h >>> 13;
55
- h = Umul32(h, m);
56
- h ^= h >>> 15;
57
- return h >>> 0;
22
+ const m = 1540483477;
23
+ const r = 24;
24
+ let h = seed ^ str.length;
25
+ let length = str.length;
26
+ let currentIndex = 0;
27
+ while (length >= 4) {
28
+ let k = UInt32(str, currentIndex);
29
+ k = Umul32(k, m);
30
+ k ^= k >>> r;
31
+ k = Umul32(k, m);
32
+ h = Umul32(h, m);
33
+ h ^= k;
34
+ currentIndex += 4;
35
+ length -= 4;
36
+ }
37
+ switch (length) {
38
+ case 3:
39
+ h ^= UInt16(str, currentIndex);
40
+ h ^= str.charCodeAt(currentIndex + 2) << 16;
41
+ h = Umul32(h, m);
42
+ break;
43
+ case 2:
44
+ h ^= UInt16(str, currentIndex);
45
+ h = Umul32(h, m);
46
+ break;
47
+ case 1:
48
+ h ^= str.charCodeAt(currentIndex);
49
+ h = Umul32(h, m);
50
+ break;
51
+ }
52
+ h ^= h >>> 13;
53
+ h = Umul32(h, m);
54
+ h ^= h >>> 15;
55
+ return h >>> 0;
58
56
  }
59
57
  export function slugify(code) {
60
- return doHash(code).toString(36);
58
+ return doHash(code).toString(36);
61
59
  }
62
- //# sourceMappingURL=slugify.js.map
60
+ //# sourceMappingURL=slugify.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"slugify.js","names":["UInt32","str","pos","charCodeAt","UInt16","Umul32","n","m","nlo","nhi","doHash","seed","r","h","length","currentIndex","k","slugify","code","toString"],"sources":["../src/slugify.ts"],"sourcesContent":["/* eslint-disable no-plusplus, no-bitwise, default-case, no-param-reassign, prefer-destructuring */\n/**\n * This file contains a utility to generate hashes to be used as generated class names\n */\n\n/**\n * murmurhash2 via https://gist.github.com/raycmorgan/588423\n */\n\nfunction UInt32(str: string, pos: number) {\n return (\n str.charCodeAt(pos++) +\n (str.charCodeAt(pos++) << 8) +\n (str.charCodeAt(pos++) << 16) +\n (str.charCodeAt(pos) << 24)\n );\n}\n\nfunction UInt16(str: string, pos: number) {\n return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8);\n}\n\nfunction Umul32(n: number, m: number) {\n n |= 0;\n m |= 0;\n const nlo = n & 0xffff;\n const nhi = n >>> 16;\n return (nlo * m + (((nhi * m) & 0xffff) << 16)) | 0;\n}\n\nfunction doHash(str: string, seed = 0) {\n const m = 0x5bd1e995;\n const r = 24;\n let h = seed ^ str.length;\n let length = str.length;\n let currentIndex = 0;\n\n while (length >= 4) {\n let k = UInt32(str, currentIndex);\n\n k = Umul32(k, m);\n k ^= k >>> r;\n k = Umul32(k, m);\n\n h = Umul32(h, m);\n h ^= k;\n\n currentIndex += 4;\n length -= 4;\n }\n\n switch (length) {\n case 3:\n h ^= UInt16(str, currentIndex);\n h ^= str.charCodeAt(currentIndex + 2) << 16;\n h = Umul32(h, m);\n break;\n\n case 2:\n h ^= UInt16(str, currentIndex);\n h = Umul32(h, m);\n break;\n\n case 1:\n h ^= str.charCodeAt(currentIndex);\n h = Umul32(h, m);\n break;\n }\n\n h ^= h >>> 13;\n h = Umul32(h, m);\n h ^= h >>> 15;\n\n return h >>> 0;\n}\n\nexport function slugify(code: string) {\n return doHash(code).toString(36);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAASA,MAAMA,CAACC,GAAW,EAAEC,GAAW,EAAE;EACxC,OACED,GAAG,CAACE,UAAU,CAACD,GAAG,EAAE,CAAC,IACpBD,GAAG,CAACE,UAAU,CAACD,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,IAC3BD,GAAG,CAACE,UAAU,CAACD,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,IAC5BD,GAAG,CAACE,UAAU,CAACD,GAAG,CAAC,IAAI,EAAE,CAAC;AAE/B;AAEA,SAASE,MAAMA,CAACH,GAAW,EAAEC,GAAW,EAAE;EACxC,OAAOD,GAAG,CAACE,UAAU,CAACD,GAAG,EAAE,CAAC,IAAID,GAAG,CAACE,UAAU,CAACD,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AAC7D;AAEA,SAASG,MAAMA,CAACC,CAAS,EAAEC,CAAS,EAAE;EACpCD,CAAC,IAAI,CAAC;EACNC,CAAC,IAAI,CAAC;EACN,MAAMC,GAAG,GAAGF,CAAC,GAAG,MAAM;EACtB,MAAMG,GAAG,GAAGH,CAAC,KAAK,EAAE;EACpB,OAAQE,GAAG,GAAGD,CAAC,IAAI,CAAEE,GAAG,GAAGF,CAAC,GAAI,MAAM,KAAK,EAAE,CAAC,GAAI,CAAC;AACrD;AAEA,SAASG,MAAMA,CAACT,GAAW,EAAEU,IAAI,GAAG,CAAC,EAAE;EACrC,MAAMJ,CAAC,GAAG,UAAU;EACpB,MAAMK,CAAC,GAAG,EAAE;EACZ,IAAIC,CAAC,GAAGF,IAAI,GAAGV,GAAG,CAACa,MAAM;EACzB,IAAIA,MAAM,GAAGb,GAAG,CAACa,MAAM;EACvB,IAAIC,YAAY,GAAG,CAAC;EAEpB,OAAOD,MAAM,IAAI,CAAC,EAAE;IAClB,IAAIE,CAAC,GAAGhB,MAAM,CAACC,GAAG,EAAEc,YAAY,CAAC;IAEjCC,CAAC,GAAGX,MAAM,CAACW,CAAC,EAAET,CAAC,CAAC;IAChBS,CAAC,IAAIA,CAAC,KAAKJ,CAAC;IACZI,CAAC,GAAGX,MAAM,CAACW,CAAC,EAAET,CAAC,CAAC;IAEhBM,CAAC,GAAGR,MAAM,CAACQ,CAAC,EAAEN,CAAC,CAAC;IAChBM,CAAC,IAAIG,CAAC;IAEND,YAAY,IAAI,CAAC;IACjBD,MAAM,IAAI,CAAC;EACb;EAEA,QAAQA,MAAM;IACZ,KAAK,CAAC;MACJD,CAAC,IAAIT,MAAM,CAACH,GAAG,EAAEc,YAAY,CAAC;MAC9BF,CAAC,IAAIZ,GAAG,CAACE,UAAU,CAACY,YAAY,GAAG,CAAC,CAAC,IAAI,EAAE;MAC3CF,CAAC,GAAGR,MAAM,CAACQ,CAAC,EAAEN,CAAC,CAAC;MAChB;IAEF,KAAK,CAAC;MACJM,CAAC,IAAIT,MAAM,CAACH,GAAG,EAAEc,YAAY,CAAC;MAC9BF,CAAC,GAAGR,MAAM,CAACQ,CAAC,EAAEN,CAAC,CAAC;MAChB;IAEF,KAAK,CAAC;MACJM,CAAC,IAAIZ,GAAG,CAACE,UAAU,CAACY,YAAY,CAAC;MACjCF,CAAC,GAAGR,MAAM,CAACQ,CAAC,EAAEN,CAAC,CAAC;MAChB;EACJ;EAEAM,CAAC,IAAIA,CAAC,KAAK,EAAE;EACbA,CAAC,GAAGR,MAAM,CAACQ,CAAC,EAAEN,CAAC,CAAC;EAChBM,CAAC,IAAIA,CAAC,KAAK,EAAE;EAEb,OAAOA,CAAC,KAAK,CAAC;AAChB;AAEA,OAAO,SAASI,OAAOA,CAACC,IAAY,EAAE;EACpC,OAAOR,MAAM,CAACQ,IAAI,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC;AAClC","ignoreList":[]}
1
+ {"mappings":";;;;;;;AASA,SAAS,OAAO,KAAa,KAAa;AACxC,QACE,IAAI,WAAW,MAAM,IACpB,IAAI,WAAW,MAAM,IAAI,MACzB,IAAI,WAAW,MAAM,IAAI,OACzB,IAAI,WAAW,IAAI,IAAI;;AAI5B,SAAS,OAAO,KAAa,KAAa;AACxC,QAAO,IAAI,WAAW,MAAM,IAAI,IAAI,WAAW,MAAM,IAAI;;AAG3D,SAAS,OAAO,GAAW,GAAW;AACpC,MAAK;AACL,MAAK;CACL,MAAM,MAAM,IAAI;CAChB,MAAM,MAAM,MAAM;AAClB,QAAQ,MAAM,MAAO,MAAM,IAAK,UAAW,MAAO;;AAGpD,SAAS,OAAO,KAAa,OAAO,GAAG;CACrC,MAAM,IAAI;CACV,MAAM,IAAI;CACV,IAAI,IAAI,OAAO,IAAI;CACnB,IAAI,SAAS,IAAI;CACjB,IAAI,eAAe;AAEnB,QAAO,UAAU,GAAG;EAClB,IAAI,IAAI,OAAO,KAAK,aAAa;AAEjC,MAAI,OAAO,GAAG,EAAE;AAChB,OAAK,MAAM;AACX,MAAI,OAAO,GAAG,EAAE;AAEhB,MAAI,OAAO,GAAG,EAAE;AAChB,OAAK;AAEL,kBAAgB;AAChB,YAAU;;AAGZ,SAAQ,QAAR;EACE,KAAK;AACH,QAAK,OAAO,KAAK,aAAa;AAC9B,QAAK,IAAI,WAAW,eAAe,EAAE,IAAI;AACzC,OAAI,OAAO,GAAG,EAAE;AAChB;EAEF,KAAK;AACH,QAAK,OAAO,KAAK,aAAa;AAC9B,OAAI,OAAO,GAAG,EAAE;AAChB;EAEF,KAAK;AACH,QAAK,IAAI,WAAW,aAAa;AACjC,OAAI,OAAO,GAAG,EAAE;AAChB;;AAGJ,MAAK,MAAM;AACX,KAAI,OAAO,GAAG,EAAE;AAChB,MAAK,MAAM;AAEX,QAAO,MAAM;;AAGf,OAAO,SAAS,QAAQ,MAAc;AACpC,QAAO,OAAO,KAAK,CAAC,SAAS,GAAG","names":[],"sources":["../src/slugify.ts"],"version":3,"sourcesContent":["/* eslint-disable no-plusplus, no-bitwise, default-case, no-param-reassign, prefer-destructuring */\n/**\n * This file contains a utility to generate hashes to be used as generated class names\n */\n\n/**\n * murmurhash2 via https://gist.github.com/raycmorgan/588423\n */\n\nfunction UInt32(str: string, pos: number) {\n return (\n str.charCodeAt(pos++) +\n (str.charCodeAt(pos++) << 8) +\n (str.charCodeAt(pos++) << 16) +\n (str.charCodeAt(pos) << 24)\n );\n}\n\nfunction UInt16(str: string, pos: number) {\n return str.charCodeAt(pos++) + (str.charCodeAt(pos++) << 8);\n}\n\nfunction Umul32(n: number, m: number) {\n n |= 0;\n m |= 0;\n const nlo = n & 0xffff;\n const nhi = n >>> 16;\n return (nlo * m + (((nhi * m) & 0xffff) << 16)) | 0;\n}\n\nfunction doHash(str: string, seed = 0) {\n const m = 0x5bd1e995;\n const r = 24;\n let h = seed ^ str.length;\n let length = str.length;\n let currentIndex = 0;\n\n while (length >= 4) {\n let k = UInt32(str, currentIndex);\n\n k = Umul32(k, m);\n k ^= k >>> r;\n k = Umul32(k, m);\n\n h = Umul32(h, m);\n h ^= k;\n\n currentIndex += 4;\n length -= 4;\n }\n\n switch (length) {\n case 3:\n h ^= UInt16(str, currentIndex);\n h ^= str.charCodeAt(currentIndex + 2) << 16;\n h = Umul32(h, m);\n break;\n\n case 2:\n h ^= UInt16(str, currentIndex);\n h = Umul32(h, m);\n break;\n\n case 1:\n h ^= str.charCodeAt(currentIndex);\n h = Umul32(h, m);\n break;\n }\n\n h ^= h >>> 13;\n h = Umul32(h, m);\n h ^= h >>> 15;\n\n return h >>> 0;\n}\n\nexport function slugify(code: string) {\n return doHash(code).toString(36);\n}\n"],"file":"slugify.js"}
package/esm/types.js CHANGED
@@ -1,11 +1,7 @@
1
- export let ValueType = /*#__PURE__*/function (ValueType) {
2
- ValueType[ValueType["LAZY"] = 0] = "LAZY";
3
- ValueType[ValueType["FUNCTION"] = 1] = "FUNCTION";
4
- ValueType[ValueType["CONST"] = 2] = "CONST";
5
- return ValueType;
1
+ export let ValueType = /* @__PURE__ */ function(ValueType) {
2
+ ValueType[ValueType["LAZY"] = 0] = "LAZY";
3
+ ValueType[ValueType["FUNCTION"] = 1] = "FUNCTION";
4
+ ValueType[ValueType["CONST"] = 2] = "CONST";
5
+ return ValueType;
6
6
  }({});
7
-
8
- /**
9
- * CSS-related types
10
- */
11
- //# sourceMappingURL=types.js.map
7
+ //# sourceMappingURL=types.js.map
package/esm/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["ValueType"],"sources":["../src/types.ts"],"sourcesContent":["import type {\n BigIntLiteral,\n BooleanLiteral,\n DecimalLiteral,\n Identifier,\n NullLiteral,\n NumericLiteral,\n StringLiteral,\n} from '@babel/types';\n\nexport type Artifact = [name: string, data: unknown];\n\nexport type BuildCodeFrameErrorFn = <TError extends Error>(\n msg: string,\n Error?: new (innerMsg: string) => TError\n) => TError;\n\nexport enum ValueType {\n LAZY,\n FUNCTION,\n CONST,\n}\n\nexport type LazyValue = {\n buildCodeFrameError: BuildCodeFrameErrorFn;\n ex: Identifier;\n importedFrom?: string[];\n kind: ValueType.LAZY;\n source: string;\n};\n\nexport type FunctionValue = {\n buildCodeFrameError: BuildCodeFrameErrorFn;\n ex: Identifier;\n importedFrom?: string[];\n kind: ValueType.FUNCTION;\n source: string;\n};\n\nexport type ConstValue = {\n buildCodeFrameError: BuildCodeFrameErrorFn;\n ex:\n | StringLiteral\n | NumericLiteral\n | NullLiteral\n | BooleanLiteral\n | BigIntLiteral\n | DecimalLiteral;\n kind: ValueType.CONST;\n source: string;\n value: string | number | boolean | null;\n};\n\nexport type ExpressionValue = LazyValue | FunctionValue | ConstValue;\n\nexport type WYWEvalMeta = {\n __wyw_meta: {\n className: string;\n extends: WYWEvalMeta;\n };\n};\n\nexport type Location = {\n column: number;\n line: number;\n};\n\nexport type Replacement = {\n length: number;\n original: { end: Location; start: Location };\n};\n\nexport type Replacements = Array<Replacement>;\n\n/**\n * CSS-related types\n */\n\nexport interface ICSSRule {\n atom?: boolean;\n className: string;\n cssText: string;\n displayName: string;\n start: Location | null | undefined;\n}\n\nexport type Rules = Record<string, ICSSRule>;\n"],"mappings":"AAiBA,WAAYA,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA;;AAyDrB;AACA;AACA","ignoreList":[]}
1
+ {"mappings":"AAOA,OAAO,IAAK,YAAL;AACL;AACA;AACA;;KACD","names":[],"sources":["../src/types.ts"],"version":3,"sourcesContent":["export type Artifact = [name: string, data: unknown];\n\nexport type BuildCodeFrameErrorFn = <TError extends Error>(\n msg: string,\n Error?: new (innerMsg: string) => TError\n) => TError;\n\nexport enum ValueType {\n LAZY,\n FUNCTION,\n CONST,\n}\n\nexport type SourceLocation = {\n end: Location;\n filename?: string;\n identifierName?: string | null;\n start: Location;\n};\n\nexport type AstNode = {\n end?: number | null;\n loc?: SourceLocation | null;\n start?: number | null;\n type: string;\n};\n\nexport type AstExpression = AstNode;\n\nexport type Identifier = AstExpression & {\n name: string;\n type: 'Identifier';\n};\n\nexport type StringLiteral = AstExpression & {\n type: 'StringLiteral';\n value: string;\n};\n\nexport type NumericLiteral = AstExpression & {\n type: 'NumericLiteral';\n value: number;\n};\n\nexport type NullLiteral = AstExpression & {\n type: 'NullLiteral';\n};\n\nexport type BooleanLiteral = AstExpression & {\n type: 'BooleanLiteral';\n value: boolean;\n};\n\nexport type BigIntLiteral = AstExpression & {\n type: 'BigIntLiteral';\n value: bigint | string;\n};\n\nexport type DecimalLiteral = AstExpression & {\n type: 'DecimalLiteral';\n value: string;\n};\n\nexport type LazyValue = {\n buildCodeFrameError: BuildCodeFrameErrorFn;\n ex: Identifier;\n importedFrom?: string[];\n kind: ValueType.LAZY;\n source: string;\n};\n\nexport type FunctionValue = {\n buildCodeFrameError: BuildCodeFrameErrorFn;\n ex: Identifier;\n importedFrom?: string[];\n kind: ValueType.FUNCTION;\n source: string;\n};\n\nexport type ConstValue = {\n buildCodeFrameError: BuildCodeFrameErrorFn;\n ex:\n | StringLiteral\n | NumericLiteral\n | NullLiteral\n | BooleanLiteral\n | BigIntLiteral\n | DecimalLiteral;\n kind: ValueType.CONST;\n source: string;\n value: string | number | boolean | null;\n};\n\nexport type ExpressionValue = LazyValue | FunctionValue | ConstValue;\n\nexport type WYWEvalMeta = {\n __wyw_meta: {\n className: string;\n extends: WYWEvalMeta;\n };\n};\n\nexport type Location = {\n column: number;\n line: number;\n};\n\nexport type Replacement = {\n length: number;\n original: { end: Location; start: Location };\n};\n\nexport type Replacements = Array<Replacement>;\n\n/**\n * CSS-related types\n */\n\nexport interface ICSSRule {\n atom?: boolean;\n className: string;\n cssText: string;\n displayName: string;\n start: Location | null | undefined;\n}\n\nexport type Rules = Record<string, ICSSRule>;\n"],"file":"types.js"}
package/package.json CHANGED
@@ -1,38 +1,40 @@
1
1
  {
2
2
  "name": "@wyw-in-js/shared",
3
- "version": "1.1.0",
3
+ "version": "2.0.0-alpha.0",
4
+ "type": "module",
4
5
  "dependencies": {
5
6
  "debug": "^4.3.4",
6
7
  "find-up": "^5.0.0",
7
8
  "minimatch": "^9.0.3"
8
9
  },
9
10
  "devDependencies": {
10
- "@babel/types": "^7.23.5",
11
- "@types/babel__core": "^7.20.5",
12
11
  "@types/debug": "^4.1.9",
13
- "@types/node": "^16.18.55",
14
- "@wyw-in-js/babel-config": "workspace:*",
12
+ "@types/node": "^22.0.0",
15
13
  "@wyw-in-js/eslint-config": "workspace:*",
16
14
  "@wyw-in-js/ts-config": "workspace:*",
17
15
  "typescript": "^5.2.2"
18
16
  },
19
17
  "engines": {
20
- "node": ">=20.0.0"
18
+ "node": ">=22.0.0"
19
+ },
20
+ "exports": {
21
+ ".": {
22
+ "types": "./types/index.d.ts",
23
+ "default": "./esm/index.js"
24
+ }
21
25
  },
22
26
  "files": [
23
27
  "esm/",
24
- "lib/",
25
28
  "types/"
26
29
  ],
27
30
  "license": "MIT",
28
- "main": "lib/index.js",
31
+ "main": "esm/index.js",
29
32
  "module": "esm/index.js",
30
33
  "publishConfig": {
31
34
  "access": "public"
32
35
  },
33
36
  "scripts": {
34
- "build:esm": "babel src --out-dir esm --extensions '.js,.jsx,.ts,.tsx' --source-maps --delete-dir-on-start",
35
- "build:lib": "cross-env NODE_ENV=legacy babel src --out-dir lib --extensions '.js,.jsx,.ts,.tsx' --source-maps --delete-dir-on-start",
37
+ "build:esm": "node ../../scripts/build-esm-oxc.mjs",
36
38
  "build:types": "tsc --project ./tsconfig.lib.json --baseUrl . --rootDir ./src",
37
39
  "lint": "eslint --ext .js,.ts .",
38
40
  "test": "bun test src"
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,13 +1,9 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.asyncResolveFallback = exports.syncResolve = void 0;
7
- const path_1 = __importDefault(require("path"));
1
+ import path from 'path';
2
+ import { createRequire } from 'module';
3
+ const nodeRequire = createRequire(import.meta.url);
8
4
  const safeResolve = (name, where) => {
9
5
  try {
10
- return require.resolve(name, {
6
+ return nodeRequire.resolve(name, {
11
7
  paths: where,
12
8
  });
13
9
  }
@@ -20,8 +16,8 @@ const suffixes = ['.js', '.ts', '.jsx', '.tsx'].reduce((acc, ext) => {
20
16
  acc.push(ext);
21
17
  return acc;
22
18
  }, []);
23
- const syncResolve = (what, importer, stack) => {
24
- const where = [importer, ...stack].map((p) => path_1.default.dirname(p));
19
+ export const syncResolve = (what, importer, stack) => {
20
+ const where = [importer, ...stack].map((p) => path.dirname(p));
25
21
  const resolved = safeResolve(what, where);
26
22
  if (!(resolved instanceof Error)) {
27
23
  return resolved;
@@ -37,9 +33,7 @@ const syncResolve = (what, importer, stack) => {
37
33
  }
38
34
  throw resolved;
39
35
  };
40
- exports.syncResolve = syncResolve;
41
- const asyncResolveFallback = (what, importer, stack) => {
42
- const resolved = (0, exports.syncResolve)(what, importer, stack);
36
+ export const asyncResolveFallback = (what, importer, stack) => {
37
+ const resolved = syncResolve(what, importer, stack);
43
38
  return Promise.resolve(resolved);
44
39
  };
45
- exports.asyncResolveFallback = asyncResolveFallback;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.asyncResolverFactory = void 0;
4
- const asyncResolverFactory = (onResolve, mapper) => {
1
+ export const asyncResolverFactory = (onResolve, mapper) => {
5
2
  const memoizedSyncResolve = new WeakMap();
6
3
  return (resolveFn) => {
7
4
  if (!memoizedSyncResolve.has(resolveFn)) {
@@ -11,4 +8,3 @@ const asyncResolverFactory = (onResolve, mapper) => {
11
8
  return memoizedSyncResolve.get(resolveFn);
12
9
  };
13
10
  };
14
- exports.asyncResolverFactory = asyncResolverFactory;
package/types/debugger.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,37 +1,33 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.findPackageJSON = findPackageJSON;
7
- const fs_1 = require("fs");
8
- const path_1 = require("path");
9
- const find_up_1 = __importDefault(require("find-up"));
1
+ import { readFileSync } from 'fs';
2
+ import { dirname, isAbsolute } from 'path';
3
+ import { createRequire } from 'module';
4
+ import findUp from 'find-up';
10
5
  const cache = new Map();
6
+ const nodeRequire = createRequire(import.meta.url);
11
7
  function findSelfPackageJSON(pkgName, filename) {
12
- const packageJSONPath = find_up_1.default.sync('package.json', {
13
- cwd: (0, path_1.dirname)(filename),
8
+ const packageJSONPath = findUp.sync('package.json', {
9
+ cwd: dirname(filename),
14
10
  });
15
11
  if (!packageJSONPath)
16
12
  return undefined;
17
13
  try {
18
- const packageJSON = JSON.parse((0, fs_1.readFileSync)(packageJSONPath, 'utf8'));
14
+ const packageJSON = JSON.parse(readFileSync(packageJSONPath, 'utf8'));
19
15
  return packageJSON?.name === pkgName ? packageJSONPath : undefined;
20
16
  }
21
17
  catch {
22
18
  return undefined;
23
19
  }
24
20
  }
25
- function findPackageJSON(pkgName, filename) {
21
+ export function findPackageJSON(pkgName, filename) {
26
22
  // Jest's resolver does not work properly with `moduleNameMapper` when `paths` are defined
27
23
  const isJest = Boolean(globalThis.process?.env?.JEST_WORKER_ID);
28
24
  const skipPathsOptions = isJest && !pkgName.startsWith('.');
29
25
  try {
30
- const pkgPath = pkgName === '.' && filename && (0, path_1.isAbsolute)(filename)
26
+ const pkgPath = pkgName === '.' && filename && isAbsolute(filename)
31
27
  ? filename
32
- : require.resolve(pkgName, filename ? { paths: [(0, path_1.dirname)(filename)] } : {});
28
+ : nodeRequire.resolve(pkgName, filename ? { paths: [dirname(filename)] } : {});
33
29
  if (!cache.has(pkgPath)) {
34
- cache.set(pkgPath, find_up_1.default.sync('package.json', { cwd: pkgPath }));
30
+ cache.set(pkgPath, findUp.sync('package.json', { cwd: pkgPath }));
35
31
  }
36
32
  return cache.get(pkgPath);
37
33
  }
@@ -52,7 +48,7 @@ function findPackageJSON(pkgName, filename) {
52
48
  try {
53
49
  const resolved = bun.resolveSync(pkgName, filename);
54
50
  if (!cache.has(resolved)) {
55
- cache.set(resolved, find_up_1.default.sync('package.json', {
51
+ cache.set(resolved, findUp.sync('package.json', {
56
52
  cwd: resolved,
57
53
  }));
58
54
  }
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasEvalMeta = hasEvalMeta;
4
- function hasEvalMeta(value) {
1
+ export function hasEvalMeta(value) {
5
2
  return typeof value === 'object' && value !== null && '__wyw_meta' in value;
6
3
  }
package/types/index.d.ts CHANGED
@@ -9,5 +9,5 @@ export { isFeatureEnabled } from './options/isFeatureEnabled';
9
9
  export { slugify } from './slugify';
10
10
  export { ValueType } from './types';
11
11
  export type { IVariableContext } from './IVariableContext';
12
- export type { ClassNameSlugVars, ClassNameFn, CodeRemoverOptions, ImportLoader, ImportLoaderContext, ImportLoaders, ImportOverride, ImportOverrides, TagResolverMeta, StrictOptions, EvalRule, Evaluator, FeatureFlag, EvaluatorConfig, FeatureFlags, VariableNameFn, } from './options/types';
13
- export type { Artifact, BuildCodeFrameErrorFn, ConstValue, ExpressionValue, FunctionValue, ICSSRule, LazyValue, Location, Replacement, Replacements, Rules, WYWEvalMeta, } from './types';
12
+ export type { ClassNameSlugVars, ClassNameFn, CodeRemoverOptions, EvalOptionsV2, EvalRequireMode, EvalResolverKind, EvalResolverMode, EvalWarning, EvalWarningCode, ImportLoader, ImportLoaderContext, ImportLoaders, ImportOverride, ImportOverrides, OxcOptions, TagResolverMeta, StrictOptions, EvalRule, EvaluatorOptions, TransformEngineOptions, Evaluator, FeatureFlag, EvaluatorConfig, FeatureFlags, VariableNameFn, } from './options/types';
13
+ export type { Artifact, AstExpression, AstNode, BigIntLiteral, BooleanLiteral, BuildCodeFrameErrorFn, ConstValue, DecimalLiteral, ExpressionValue, FunctionValue, Identifier, ICSSRule, LazyValue, Location, NullLiteral, NumericLiteral, Replacement, Replacements, Rules, SourceLocation, StringLiteral, WYWEvalMeta, } from './types';
package/types/index.js CHANGED
@@ -1,23 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ValueType = exports.slugify = exports.isFeatureEnabled = exports.logger = exports.enableDebug = exports.isBoxedPrimitive = exports.findPackageJSON = exports.hasEvalMeta = exports.asyncResolverFactory = exports.syncResolve = exports.asyncResolveFallback = void 0;
4
- var asyncResolveFallback_1 = require("./asyncResolveFallback");
5
- Object.defineProperty(exports, "asyncResolveFallback", { enumerable: true, get: function () { return asyncResolveFallback_1.asyncResolveFallback; } });
6
- Object.defineProperty(exports, "syncResolve", { enumerable: true, get: function () { return asyncResolveFallback_1.syncResolve; } });
7
- var asyncResolverFactory_1 = require("./asyncResolverFactory");
8
- Object.defineProperty(exports, "asyncResolverFactory", { enumerable: true, get: function () { return asyncResolverFactory_1.asyncResolverFactory; } });
9
- var hasEvalMeta_1 = require("./hasEvalMeta");
10
- Object.defineProperty(exports, "hasEvalMeta", { enumerable: true, get: function () { return hasEvalMeta_1.hasEvalMeta; } });
11
- var findPackageJSON_1 = require("./findPackageJSON");
12
- Object.defineProperty(exports, "findPackageJSON", { enumerable: true, get: function () { return findPackageJSON_1.findPackageJSON; } });
13
- var isBoxedPrimitive_1 = require("./isBoxedPrimitive");
14
- Object.defineProperty(exports, "isBoxedPrimitive", { enumerable: true, get: function () { return isBoxedPrimitive_1.isBoxedPrimitive; } });
15
- var logger_1 = require("./logger");
16
- Object.defineProperty(exports, "enableDebug", { enumerable: true, get: function () { return logger_1.enableDebug; } });
17
- Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_1.logger; } });
18
- var isFeatureEnabled_1 = require("./options/isFeatureEnabled");
19
- Object.defineProperty(exports, "isFeatureEnabled", { enumerable: true, get: function () { return isFeatureEnabled_1.isFeatureEnabled; } });
20
- var slugify_1 = require("./slugify");
21
- Object.defineProperty(exports, "slugify", { enumerable: true, get: function () { return slugify_1.slugify; } });
22
- var types_1 = require("./types");
23
- Object.defineProperty(exports, "ValueType", { enumerable: true, get: function () { return types_1.ValueType; } });
1
+ export { asyncResolveFallback, syncResolve } from './asyncResolveFallback';
2
+ export { asyncResolverFactory } from './asyncResolverFactory';
3
+ export { hasEvalMeta } from './hasEvalMeta';
4
+ export { findPackageJSON } from './findPackageJSON';
5
+ export { isBoxedPrimitive } from './isBoxedPrimitive';
6
+ export { enableDebug, logger } from './logger';
7
+ export { isFeatureEnabled } from './options/isFeatureEnabled';
8
+ export { slugify } from './slugify';
9
+ export { ValueType } from './types';
@@ -1,10 +1,7 @@
1
- "use strict";
2
1
  // There is a problem with using boxed numbers and strings in TS,
3
2
  // so we cannot just use `instanceof` here
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.isBoxedPrimitive = isBoxedPrimitive;
6
3
  const constructors = ['Number', 'String'];
7
- function isBoxedPrimitive(o) {
4
+ export function isBoxedPrimitive(o) {
8
5
  if (typeof o !== 'object' || o === null)
9
6
  return false;
10
7
  return (constructors.includes(o.constructor.name) &&
package/types/logger.js CHANGED
@@ -1,33 +1,26 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.logger = void 0;
7
- exports.enableDebug = enableDebug;
8
- const debug_1 = __importDefault(require("debug"));
1
+ import genericDebug from 'debug';
9
2
  const BASE_NAMESPACE = 'wyw-in-js';
10
- exports.logger = (0, debug_1.default)(BASE_NAMESPACE);
3
+ export const logger = genericDebug(BASE_NAMESPACE);
11
4
  const loggers = new Map();
12
5
  function gerOrCreate(namespace) {
13
6
  if (!namespace)
14
- return exports.logger;
7
+ return logger;
15
8
  const lastIndexOf = namespace.lastIndexOf(':');
16
9
  if (!loggers.has(namespace)) {
17
10
  loggers.set(namespace, gerOrCreate(namespace.substring(0, lastIndexOf)).extend(namespace.substring(lastIndexOf + 1)));
18
11
  }
19
12
  return loggers.get(namespace);
20
13
  }
21
- debug_1.default.formatters.r = (ref) => {
14
+ genericDebug.formatters.r = (ref) => {
22
15
  const namespace = typeof ref === 'string' ? ref : ref.namespace;
23
16
  const text = typeof ref === 'string' ? namespace : ref.text ?? namespace;
24
17
  const color = parseInt(gerOrCreate(namespace).color, 10);
25
18
  const colorCode = `\u001B[3${color < 8 ? color : `8;5;${color}`}`;
26
19
  return `${colorCode};1m${text}\u001B[0m`;
27
20
  };
28
- debug_1.default.formatters.f = function f(fn) {
21
+ genericDebug.formatters.f = function f(fn) {
29
22
  return JSON.stringify(fn());
30
23
  };
31
- function enableDebug(namespace = `${BASE_NAMESPACE}:*`) {
32
- debug_1.default.enable(namespace);
24
+ export function enableDebug(namespace = `${BASE_NAMESPACE}:*`) {
25
+ genericDebug.enable(namespace);
33
26
  }
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFeatureEnabled = void 0;
4
- const minimatch_1 = require("minimatch");
1
+ import { Minimatch } from 'minimatch';
5
2
  const cachedMatchers = new Map();
6
- const isFeatureEnabled = (features, featureName, filename) => {
3
+ export const isFeatureEnabled = (features, featureName, filename) => {
7
4
  const value = features?.[featureName] ?? false;
8
5
  if (typeof value === 'boolean') {
9
6
  return value;
@@ -20,11 +17,10 @@ const isFeatureEnabled = (features, featureName, filename) => {
20
17
  .map((pattern) => {
21
18
  let matcher = cachedMatchers.get(pattern);
22
19
  if (!matcher) {
23
- matcher = [pattern.startsWith('!'), new minimatch_1.Minimatch(pattern)];
20
+ matcher = [pattern.startsWith('!'), new Minimatch(pattern)];
24
21
  cachedMatchers.set(pattern, matcher);
25
22
  }
26
23
  return [matcher[0], matcher[1].match(filename)];
27
24
  })
28
25
  .reduce((acc, [negated, match]) => (negated ? acc && match : acc || match), false);
29
26
  };
30
- exports.isFeatureEnabled = isFeatureEnabled;
@@ -1,7 +1,4 @@
1
- import type { TransformOptions } from '@babel/core';
2
- import type { File } from '@babel/types';
3
1
  import type { IVariableContext } from '../IVariableContext';
4
- import type { Core } from '../babel';
5
2
  type VmContext = Record<string, any>;
6
3
  export type ClassNameSlugVars = {
7
4
  dir: string;
@@ -21,15 +18,35 @@ export type EvaluatorConfig = {
21
18
  onlyExports: string[];
22
19
  root?: string;
23
20
  };
24
- export type Evaluator = (evalConfig: TransformOptions, ast: File, code: string, config: EvaluatorConfig, babel: Core) => [
25
- ast: File,
21
+ export type EvaluatorOptions = {
22
+ ast?: boolean | null;
23
+ configFile?: boolean | null | string;
24
+ env?: Record<string, EvaluatorOptions | null | undefined> | null;
25
+ filename?: string | null;
26
+ inputSourceMap?: object | null;
27
+ overrides?: EvaluatorOptions[] | null;
28
+ plugins?: unknown[] | null;
29
+ presets?: unknown[] | null;
30
+ root?: string | null;
31
+ sourceFileName?: string | null;
32
+ sourceMaps?: boolean | 'both' | 'inline' | null;
33
+ [key: string]: unknown;
34
+ };
35
+ export type TransformEngineOptions = EvaluatorOptions;
36
+ export type EvaluatorAst = unknown;
37
+ export type EvaluatorRuntime = unknown;
38
+ export type Evaluator = (evalConfig: EvaluatorOptions, ast: EvaluatorAst, code: string, config: EvaluatorConfig, runtime: EvaluatorRuntime) => [
39
+ ast: EvaluatorAst,
26
40
  code: string,
27
41
  imports: Map<string, string[]> | null,
28
42
  exports?: string[] | null
29
43
  ];
30
44
  export type EvalRule = {
31
45
  action: Evaluator | 'ignore' | string;
32
- babelOptions?: TransformOptions;
46
+ /**
47
+ * Per-rule Oxc options for the Oxc-first transform path.
48
+ */
49
+ oxcOptions?: OxcOptions;
33
50
  test?: RegExp | ((path: string, code: string) => boolean);
34
51
  };
35
52
  export type FeatureFlag = boolean | string | string[];
@@ -76,6 +93,39 @@ export type ImportLoaderContext = {
76
93
  };
77
94
  export type ImportLoader = 'raw' | 'url' | ((context: ImportLoaderContext) => unknown);
78
95
  export type ImportLoaders = Record<string, ImportLoader | false>;
96
+ export type EvalResolverMode = 'bundler' | 'hybrid' | 'node' | 'custom';
97
+ export type EvalRequireMode = 'warn-and-run' | 'error' | 'off';
98
+ export type EvalResolverKind = 'import' | 'dynamic-import' | 'require';
99
+ export type EvalWarningCode = 'resolve-fallback' | 'resolve-error' | 'require-fallback' | 'require-error' | 'dynamic-import' | 'eval-error';
100
+ export type EvalWarning = {
101
+ code: EvalWarningCode;
102
+ message: string;
103
+ importer?: string;
104
+ specifier?: string;
105
+ resolved?: string | null;
106
+ callstack?: string[];
107
+ hint?: string;
108
+ };
109
+ export type EvalOptionsV2 = {
110
+ /**
111
+ * Default is `bundler`. `hybrid` is an opt-in mode whose intended
112
+ * precedence is customResolver -> safe Oxc subset -> bundler -> node.
113
+ */
114
+ resolver?: EvalResolverMode;
115
+ customResolver?: (specifier: string, importer: string, kind: EvalResolverKind) => Promise<{
116
+ id: string;
117
+ external?: boolean;
118
+ } | null>;
119
+ customLoader?: (id: string) => Promise<{
120
+ code: string;
121
+ map?: unknown;
122
+ loader?: string;
123
+ } | null>;
124
+ require?: EvalRequireMode;
125
+ mode?: 'strict' | 'loose';
126
+ globals?: Record<string, unknown>;
127
+ onWarn?: (warning: EvalWarning) => void;
128
+ };
79
129
  export type TagResolverMeta = {
80
130
  resolvedSource?: string;
81
131
  sourceFile: string | null | undefined;
@@ -85,7 +135,7 @@ type AllFeatureFlags = {
85
135
  globalCache: FeatureFlag;
86
136
  happyDOM: FeatureFlag;
87
137
  softErrors: FeatureFlag;
88
- useBabelConfigs: FeatureFlag;
138
+ staticImportValues: FeatureFlag;
89
139
  useWeakRefInEval: FeatureFlag;
90
140
  };
91
141
  export type FeatureFlags<TOnly extends keyof AllFeatureFlags = keyof AllFeatureFlags> = Pick<AllFeatureFlags, TOnly>;
@@ -93,13 +143,28 @@ export type CodeRemoverOptions = {
93
143
  componentTypes?: Record<string, string[]>;
94
144
  hocs?: Record<string, string[]>;
95
145
  };
146
+ export type OxcOptions = {
147
+ /**
148
+ * Parser-level Oxc options. The first slice only preserves this contract.
149
+ */
150
+ parser?: Record<string, unknown>;
151
+ /**
152
+ * Resolver-level Oxc options. Bundler-aware resolution remains authoritative
153
+ * unless `eval.resolver` explicitly opts into `hybrid`.
154
+ */
155
+ resolver?: Record<string, unknown>;
156
+ /**
157
+ * Transform-level Oxc options.
158
+ */
159
+ transform?: Record<string, unknown>;
160
+ };
96
161
  export type StrictOptions = {
97
- babelOptions: TransformOptions;
98
162
  classNameSlug?: string | ClassNameFn;
99
163
  codeRemover?: CodeRemoverOptions;
100
164
  conditionNames?: string[];
101
165
  displayName: boolean;
102
166
  evaluate: boolean;
167
+ eval?: EvalOptionsV2;
103
168
  extensions: string[];
104
169
  features: FeatureFlags;
105
170
  highPriorityPlugins: string[];
@@ -108,8 +173,13 @@ export type StrictOptions = {
108
173
  importOverrides?: ImportOverrides;
109
174
  outputMetadata: boolean;
110
175
  overrideContext?: (context: Partial<VmContext>, filename: string) => Partial<VmContext>;
176
+ /**
177
+ * Oxc-first transform options.
178
+ */
179
+ oxcOptions: OxcOptions;
111
180
  rules: EvalRule[];
112
181
  tagResolver?: (source: string, tag: string, meta: TagResolverMeta) => string | null;
182
+ evalConsole?: 'warning' | 'pipe';
113
183
  variableNameConfig?: 'var' | 'dashes' | 'raw';
114
184
  variableNameSlug?: string | VariableNameFn;
115
185
  };
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/types/slugify.js CHANGED
@@ -1,10 +1,7 @@
1
- "use strict";
2
1
  /* eslint-disable no-plusplus, no-bitwise, default-case, no-param-reassign, prefer-destructuring */
3
2
  /**
4
3
  * This file contains a utility to generate hashes to be used as generated class names
5
4
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.slugify = slugify;
8
5
  /**
9
6
  * murmurhash2 via https://gist.github.com/raycmorgan/588423
10
7
  */
@@ -60,6 +57,6 @@ function doHash(str, seed = 0) {
60
57
  h ^= h >>> 15;
61
58
  return h >>> 0;
62
59
  }
63
- function slugify(code) {
60
+ export function slugify(code) {
64
61
  return doHash(code).toString(36);
65
62
  }