@navita/core 1.0.0 → 3.0.0-next.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.
@@ -1,55 +1,46 @@
1
- import { setAdapter as setAdapter$1 } from '@navita/adapter';
2
- import { ClassList } from '@navita/engine';
3
-
4
- function setAdapter({ engine , resultCache , }) {
5
- setAdapter$1({
6
- generateIdentifier: (value)=>engine.generateIdentifier(value),
7
- addStaticCss: (selector, css)=>engine.addStatic(selector, css),
8
- addCss: (css)=>engine.addStyle(css),
9
- addKeyframe: (keyframe)=>engine.addKeyframes(keyframe),
10
- addFontFace: (fontFace)=>{
11
- const hasFontFamily = (Array.isArray(fontFace) ? fontFace : [
12
- fontFace
13
- ]).some((fontFace)=>'fontFamily' in fontFace);
14
- if (hasFontFamily) {
15
- throw new Error('This function creates and returns a font-family name, so the "fontFamily" property should not be provided.');
16
- }
17
- return engine.addFontFace(fontFace);
18
- },
19
- collectResult ({ index , filePath , identifier , result: resultFactory , sourceMap: { line , column } , position , }) {
20
- engine.setFilePath(filePath);
21
- let result = resultFactory();
22
- engine.setFilePath(undefined);
23
- if (result instanceof ClassList) {
24
- const extraClass = engine.addSourceMapReference({
25
- index,
26
- identifier,
27
- classList: result,
28
- filePath,
29
- line,
30
- column
31
- });
32
- if (extraClass) {
33
- result = new ClassList([
34
- result.toString(),
35
- extraClass
36
- ].join(' '));
37
- }
38
- }
39
- if (resultCache) {
40
- if (!resultCache[filePath]) {
41
- resultCache[filePath] = [];
42
- }
43
- const [start, end] = position;
44
- resultCache[filePath][index] = {
45
- start,
46
- end,
47
- value: result === undefined ? "undefined" : JSON.stringify(result)
48
- };
49
- }
50
- return result;
51
- }
52
- });
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { ClassList } from "@navita/engine";
5
+ import { setAdapter as setAdapter$1 } from "@navita/adapter";
6
+ //#region src/helpers/setAdapter.ts
7
+ function setAdapter({ engine, resultCache }) {
8
+ setAdapter$1({
9
+ generateIdentifier: (value) => engine.generateIdentifier(value),
10
+ addStaticCss: (selector, css) => engine.addStatic(selector, css),
11
+ addCss: (css) => engine.addStyle(css),
12
+ addKeyframe: (keyframe) => engine.addKeyframes(keyframe),
13
+ addFontFace: (fontFace) => {
14
+ if ((Array.isArray(fontFace) ? fontFace : [fontFace]).some((fontFace) => "fontFamily" in fontFace)) throw new Error("This function creates and returns a font-family name, so the \"fontFamily\" property should not be provided.");
15
+ return engine.addFontFace(fontFace);
16
+ },
17
+ collectResult({ index, filePath, identifier, result: resultFactory, sourceMap: { line, column }, position }) {
18
+ engine.setFilePath(filePath);
19
+ let result = resultFactory();
20
+ engine.setFilePath(void 0);
21
+ if (result instanceof ClassList) {
22
+ const extraClass = engine.addSourceMapReference({
23
+ index,
24
+ identifier,
25
+ classList: result,
26
+ filePath,
27
+ line,
28
+ column
29
+ });
30
+ if (extraClass) result = new ClassList([result.toString(), extraClass].join(" "));
31
+ }
32
+ if (resultCache) {
33
+ if (!resultCache[filePath]) resultCache[filePath] = [];
34
+ const [start, end] = position;
35
+ resultCache[filePath][index] = {
36
+ start,
37
+ end,
38
+ value: result === void 0 ? "undefined" : JSON.stringify(result)
39
+ };
40
+ }
41
+ return result;
42
+ }
43
+ });
53
44
  }
54
-
45
+ //#endregion
55
46
  export { setAdapter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navita/core",
3
- "version": "1.0.0",
3
+ "version": "3.0.0-next.0",
4
4
  "description": "Core package for Navita. Used for creating integrations.",
5
5
  "keywords": [
6
6
  "core",
@@ -26,12 +26,12 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "enhanced-resolve": "5.15.0",
29
- "outdent": "^0.8.0",
30
29
  "magic-string": "^0.30.3",
31
- "@navita/types": "0.1.0",
32
- "@navita/adapter": "0.1.0",
33
- "@navita/swc": "0.1.0",
34
- "@navita/engine": "0.2.1"
30
+ "outdent": "^0.8.0",
31
+ "@navita/adapter": "3.0.0-next.0",
32
+ "@navita/engine": "3.0.0-next.0",
33
+ "@navita/extraction": "3.0.0-next.0",
34
+ "@navita/types": "3.0.0-next.0"
35
35
  },
36
36
  "license": "MIT",
37
37
  "author": "Eagerpatch",