@intlayer/core 5.7.7 → 5.8.0-canary.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/dist/cjs/formatters/compact.cjs +47 -0
- package/dist/cjs/formatters/compact.cjs.map +1 -0
- package/dist/cjs/formatters/currency.cjs +51 -0
- package/dist/cjs/formatters/currency.cjs.map +1 -0
- package/dist/cjs/formatters/date.cjs +83 -0
- package/dist/cjs/formatters/date.cjs.map +1 -0
- package/dist/cjs/formatters/index.cjs +37 -0
- package/dist/cjs/formatters/index.cjs.map +1 -0
- package/dist/cjs/formatters/list.cjs +48 -0
- package/dist/cjs/formatters/list.cjs.map +1 -0
- package/dist/cjs/formatters/number.cjs +44 -0
- package/dist/cjs/formatters/number.cjs.map +1 -0
- package/dist/cjs/formatters/percentage.cjs +54 -0
- package/dist/cjs/formatters/percentage.cjs.map +1 -0
- package/dist/cjs/formatters/relativeTime.cjs +75 -0
- package/dist/cjs/formatters/relativeTime.cjs.map +1 -0
- package/dist/cjs/formatters/units.cjs +49 -0
- package/dist/cjs/formatters/units.cjs.map +1 -0
- package/dist/cjs/index.cjs +4 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/localization/getLocaleName.cjs +5 -15
- package/dist/cjs/localization/getLocaleName.cjs.map +1 -1
- package/dist/cjs/types/index.cjs +2 -2
- package/dist/cjs/types/index.cjs.map +1 -1
- package/dist/cjs/utils/intl.cjs +74 -0
- package/dist/cjs/utils/intl.cjs.map +1 -0
- package/dist/esm/formatters/compact.mjs +13 -0
- package/dist/esm/formatters/compact.mjs.map +1 -0
- package/dist/esm/formatters/currency.mjs +17 -0
- package/dist/esm/formatters/currency.mjs.map +1 -0
- package/dist/esm/formatters/date.mjs +49 -0
- package/dist/esm/formatters/date.mjs.map +1 -0
- package/dist/esm/formatters/index.mjs +9 -0
- package/dist/esm/formatters/index.mjs.map +1 -0
- package/dist/esm/formatters/list.mjs +14 -0
- package/dist/esm/formatters/list.mjs.map +1 -0
- package/dist/esm/formatters/number.mjs +10 -0
- package/dist/esm/formatters/number.mjs.map +1 -0
- package/dist/esm/formatters/percentage.mjs +20 -0
- package/dist/esm/formatters/percentage.mjs.map +1 -0
- package/dist/esm/formatters/relativeTime.mjs +41 -0
- package/dist/esm/formatters/relativeTime.mjs.map +1 -0
- package/dist/esm/formatters/units.mjs +15 -0
- package/dist/esm/formatters/units.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/localization/getLocaleName.mjs +5 -15
- package/dist/esm/localization/getLocaleName.mjs.map +1 -1
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/index.mjs.map +1 -1
- package/dist/esm/utils/intl.mjs +39 -0
- package/dist/esm/utils/intl.mjs.map +1 -0
- package/dist/types/formatters/compact.d.ts +16 -0
- package/dist/types/formatters/compact.d.ts.map +1 -0
- package/dist/types/formatters/currency.d.ts +16 -0
- package/dist/types/formatters/currency.d.ts.map +1 -0
- package/dist/types/formatters/date.d.ts +16 -0
- package/dist/types/formatters/date.d.ts.map +1 -0
- package/dist/types/formatters/index.d.ts +9 -0
- package/dist/types/formatters/index.d.ts.map +1 -0
- package/dist/types/formatters/list.d.ts +20 -0
- package/dist/types/formatters/list.d.ts.map +1 -0
- package/dist/types/formatters/number.d.ts +12 -0
- package/dist/types/formatters/number.d.ts.map +1 -0
- package/dist/types/formatters/percentage.d.ts +12 -0
- package/dist/types/formatters/percentage.d.ts.map +1 -0
- package/dist/types/formatters/relativeTime.d.ts +8 -0
- package/dist/types/formatters/relativeTime.d.ts.map +1 -0
- package/dist/types/formatters/units.d.ts +12 -0
- package/dist/types/formatters/units.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/localization/getLocaleName.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utils/intl.d.ts +12 -0
- package/dist/types/utils/intl.d.ts.map +1 -0
- package/package.json +58 -13
- package/dist/cjs/transpiler/markdown/getMarkdownMetadata.test.cjs +0 -35
- package/dist/cjs/transpiler/markdown/getMarkdownMetadata.test.cjs.map +0 -1
- package/dist/esm/transpiler/markdown/getMarkdownMetadata.test.mjs +0 -34
- package/dist/esm/transpiler/markdown/getMarkdownMetadata.test.mjs.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
type RelativeTimeUnit = Intl.RelativeTimeFormatUnit;
|
|
3
|
+
export declare const relativeTime: (from: Date | string | number, to?: Date | string | number, options?: Intl.RelativeTimeFormatOptions & {
|
|
4
|
+
locale?: LocalesValues;
|
|
5
|
+
unit?: RelativeTimeUnit;
|
|
6
|
+
}) => string;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=relativeTime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relativeTime.d.ts","sourceRoot":"","sources":["../../../src/formatters/relativeTime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,KAAK,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC;AA6BpD,eAAO,MAAM,YAAY,GACvB,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,EAC5B,KAAI,IAAI,GAAG,MAAM,GAAG,MAAmB,EACvC,UAAU,IAAI,CAAC,yBAAyB,GAAG;IACzC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB,KACA,MAWF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
/**
|
|
3
|
+
* Formats a numeric value as a localized unit string.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* units({ value: 5, unit: "kilometer", unitDisplay: "long", locale: "en-GB" })
|
|
7
|
+
* // "5 kilometers"
|
|
8
|
+
*/
|
|
9
|
+
export declare const units: (value: number | string, options?: Intl.NumberFormatOptions & {
|
|
10
|
+
locale?: LocalesValues;
|
|
11
|
+
}) => string;
|
|
12
|
+
//# sourceMappingURL=units.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../../src/formatters/units.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAChB,OAAO,MAAM,GAAG,MAAM,EACtB,UAAU,IAAI,CAAC,mBAAmB,GAAG;IAAE,MAAM,CAAC,EAAE,aAAa,CAAA;CAAE,KAC9D,MASsB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './dictionaryManipulator/index';
|
|
2
|
+
export * from './formatters/index';
|
|
2
3
|
export * from './interpreter/index';
|
|
3
4
|
export * from './localization/index';
|
|
4
5
|
export * from './transpiler/index';
|
|
5
6
|
export * from './types/index';
|
|
6
7
|
export * from './utils/checkIsURLAbsolute';
|
|
8
|
+
export * from './utils/intl';
|
|
7
9
|
export * from './utils/isSameKeyPath';
|
|
8
10
|
export * from './utils/isValidReactElement';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocaleName.d.ts","sourceRoot":"","sources":["../../../src/localization/getLocaleName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"getLocaleName.d.ts","sourceRoot":"","sources":["../../../src/localization/getLocaleName.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,eAAO,MAAM,aAAa,GACxB,eAAe,aAAa,EAC5B,eAAc,aAA6B,KAC1C,MAOF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LocalesValues } from '@intlayer/config';
|
|
2
|
+
type IntlConstructors = {
|
|
3
|
+
[K in keyof typeof Intl as (typeof Intl)[K] extends new (...args: any) => any ? K : never]: (typeof Intl)[K];
|
|
4
|
+
};
|
|
5
|
+
type ReplaceLocaleWithLocalesValues<T> = T extends new (locales: any, options?: infer Options) => infer Instance ? new (locales?: LocalesValues, options?: Options) => Instance : T extends new (locales: any) => infer Instance ? new (locales?: LocalesValues) => Instance : T;
|
|
6
|
+
type WrappedIntl = {
|
|
7
|
+
[K in keyof typeof Intl]: K extends keyof IntlConstructors ? ReplaceLocaleWithLocalesValues<(typeof Intl)[K]> : (typeof Intl)[K];
|
|
8
|
+
};
|
|
9
|
+
export declare const createCachedIntl: () => WrappedIntl;
|
|
10
|
+
declare const CachedIntl: WrappedIntl;
|
|
11
|
+
export { CachedIntl as Intl };
|
|
12
|
+
//# sourceMappingURL=intl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intl.d.ts","sourceRoot":"","sources":["../../../src/utils/intl.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMjD,KAAK,gBAAgB,GAAG;KACrB,CAAC,IAAI,MAAM,OAAO,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,GACzE,CAAC,GACD,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;CAC7B,CAAC;AAGF,KAAK,8BAA8B,CAAC,CAAC,IAAI,CAAC,SAAS,KACjD,OAAO,EAAE,GAAG,EACZ,OAAO,CAAC,EAAE,MAAM,OAAO,KACpB,MAAM,QAAQ,GACf,KAAK,OAAO,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,QAAQ,GAC5D,CAAC,SAAS,KAAK,OAAO,EAAE,GAAG,KAAK,MAAM,QAAQ,GAC5C,KAAK,OAAO,CAAC,EAAE,aAAa,KAAK,QAAQ,GACzC,CAAC,CAAC;AAGR,KAAK,WAAW,GAAG;KAChB,CAAC,IAAI,MAAM,OAAO,IAAI,GAAG,CAAC,SAAS,MAAM,gBAAgB,GACtD,8BAA8B,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAChD,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;CACrB,CAAC;AAmDF,eAAO,MAAM,gBAAgB,QAAO,WAUN,CAAC;AAG/B,QAAA,MAAM,UAAU,aAAqB,CAAC;AAkBtC,OAAO,EAAE,UAAU,IAAI,IAAI,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0-canary.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -57,6 +57,51 @@
|
|
|
57
57
|
"require": "./dist/cjs/transpiler/file/fileBrowser.cjs",
|
|
58
58
|
"import": "./dist/esm/transpiler/file/fileBrowser.mjs"
|
|
59
59
|
},
|
|
60
|
+
"./compact": {
|
|
61
|
+
"types": "./dist/types/formatters/compact.d.ts",
|
|
62
|
+
"import": "./dist/esm/formatters/compact.mjs",
|
|
63
|
+
"require": "./dist/cjs/formatters/compact.cjs"
|
|
64
|
+
},
|
|
65
|
+
"./currency": {
|
|
66
|
+
"types": "./dist/types/formatters/currency.d.ts",
|
|
67
|
+
"import": "./dist/esm/formatters/currency.mjs",
|
|
68
|
+
"require": "./dist/cjs/formatters/currency.cjs"
|
|
69
|
+
},
|
|
70
|
+
"./date": {
|
|
71
|
+
"types": "./dist/types/formatters/date.d.ts",
|
|
72
|
+
"import": "./dist/esm/formatters/date.mjs",
|
|
73
|
+
"require": "./dist/cjs/formatters/date.cjs"
|
|
74
|
+
},
|
|
75
|
+
"./relativeTime": {
|
|
76
|
+
"types": "./dist/types/formatters/relativeTime.d.ts",
|
|
77
|
+
"import": "./dist/esm/formatters/relativeTime.mjs",
|
|
78
|
+
"require": "./dist/cjs/formatters/relativeTime.cjs"
|
|
79
|
+
},
|
|
80
|
+
"./number": {
|
|
81
|
+
"types": "./dist/types/formatters/number.d.ts",
|
|
82
|
+
"import": "./dist/esm/formatters/number.mjs",
|
|
83
|
+
"require": "./dist/cjs/formatters/number.cjs"
|
|
84
|
+
},
|
|
85
|
+
"./units": {
|
|
86
|
+
"types": "./dist/types/formatters/units.d.ts",
|
|
87
|
+
"import": "./dist/esm/formatters/units.mjs",
|
|
88
|
+
"require": "./dist/cjs/formatters/units.cjs"
|
|
89
|
+
},
|
|
90
|
+
"./list": {
|
|
91
|
+
"types": "./dist/types/formatters/list.d.ts",
|
|
92
|
+
"import": "./dist/esm/formatters/list.mjs",
|
|
93
|
+
"require": "./dist/cjs/formatters/list.cjs"
|
|
94
|
+
},
|
|
95
|
+
"./percentage": {
|
|
96
|
+
"types": "./dist/types/formatters/percentage.d.ts",
|
|
97
|
+
"import": "./dist/esm/formatters/percentage.mjs",
|
|
98
|
+
"require": "./dist/cjs/formatters/percentage.cjs"
|
|
99
|
+
},
|
|
100
|
+
"./intl": {
|
|
101
|
+
"types": "./dist/types/utils/intl.d.ts",
|
|
102
|
+
"import": "./dist/esm/utils/intl.mjs",
|
|
103
|
+
"require": "./dist/cjs/utils/intl.cjs"
|
|
104
|
+
},
|
|
60
105
|
"./package.json": "./package.json"
|
|
61
106
|
},
|
|
62
107
|
"main": "dist/cjs/index.cjs",
|
|
@@ -75,32 +120,32 @@
|
|
|
75
120
|
],
|
|
76
121
|
"dependencies": {
|
|
77
122
|
"negotiator": "^1.0.0",
|
|
78
|
-
"@intlayer/
|
|
79
|
-
"@intlayer/dictionaries-entry": "5.
|
|
80
|
-
"@intlayer/
|
|
123
|
+
"@intlayer/config": "5.8.0-canary.0",
|
|
124
|
+
"@intlayer/dictionaries-entry": "5.8.0-canary.0",
|
|
125
|
+
"@intlayer/api": "5.8.0-canary.0"
|
|
81
126
|
},
|
|
82
127
|
"devDependencies": {
|
|
83
128
|
"@types/negotiator": "^0.6.3",
|
|
84
|
-
"@types/node": "^
|
|
129
|
+
"@types/node": "^24.2.1",
|
|
85
130
|
"@typescript-eslint/parser": "^8.33.1",
|
|
86
131
|
"concurrently": "^9.1.2",
|
|
87
|
-
"eslint": "^9.
|
|
132
|
+
"eslint": "^9.33.0",
|
|
88
133
|
"prettier": "^3.5.3",
|
|
89
134
|
"rimraf": "^6.0.1",
|
|
90
135
|
"tsc-alias": "^1.8.16",
|
|
91
136
|
"tsup": "^8.5.0",
|
|
92
|
-
"typescript": "^5.
|
|
137
|
+
"typescript": "^5.9.2",
|
|
93
138
|
"vitest": "^3.2.2",
|
|
94
139
|
"@utils/ts-config": "1.0.4",
|
|
95
|
-
"@utils/
|
|
140
|
+
"@utils/tsup-config": "1.0.4",
|
|
96
141
|
"@utils/eslint-config": "1.0.4",
|
|
97
|
-
"@utils/
|
|
142
|
+
"@utils/ts-config-types": "1.0.4"
|
|
98
143
|
},
|
|
99
144
|
"peerDependencies": {
|
|
100
|
-
"@intlayer/api": "5.
|
|
101
|
-
"@intlayer/
|
|
102
|
-
"@intlayer/
|
|
103
|
-
"intlayer": "5.
|
|
145
|
+
"@intlayer/api": "5.8.0-canary.0",
|
|
146
|
+
"@intlayer/config": "5.8.0-canary.0",
|
|
147
|
+
"@intlayer/dictionaries-entry": "5.8.0-canary.0",
|
|
148
|
+
"intlayer": "5.8.0-canary.0"
|
|
104
149
|
},
|
|
105
150
|
"engines": {
|
|
106
151
|
"node": ">=14.18"
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var import_vitest = require("vitest");
|
|
3
|
-
var import__ = require('../index.cjs');
|
|
4
|
-
(0, import_vitest.describe)("getMarkdownMetadata", () => {
|
|
5
|
-
const markdown = [
|
|
6
|
-
"---",
|
|
7
|
-
"title: Mock Title",
|
|
8
|
-
"description: Mock Description",
|
|
9
|
-
"author: Mock Author",
|
|
10
|
-
"date: 2024-01-01",
|
|
11
|
-
"tags:",
|
|
12
|
-
" - tag1",
|
|
13
|
-
" - tag2",
|
|
14
|
-
" - tag3",
|
|
15
|
-
"---",
|
|
16
|
-
"# Mock Heading",
|
|
17
|
-
"This is a mock paragraph with some sample text.",
|
|
18
|
-
"Here is another mock paragraph.",
|
|
19
|
-
"## Mock Section",
|
|
20
|
-
"Some more mock content goes here.",
|
|
21
|
-
"### Mock Subsection",
|
|
22
|
-
"Final mock paragraph with test content."
|
|
23
|
-
].join("\n");
|
|
24
|
-
(0, import_vitest.it)("should return the metadata from the markdown file", () => {
|
|
25
|
-
const metadata = (0, import__.getMarkdownMetadata)(markdown);
|
|
26
|
-
(0, import_vitest.expect)(metadata).toEqual({
|
|
27
|
-
title: "Mock Title",
|
|
28
|
-
description: "Mock Description",
|
|
29
|
-
author: "Mock Author",
|
|
30
|
-
date: "2024-01-01",
|
|
31
|
-
tags: ["tag1", "tag2", "tag3"]
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=getMarkdownMetadata.test.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/markdown/getMarkdownMetadata.test.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { getMarkdownMetadata } from '..';\n\ndescribe('getMarkdownMetadata', () => {\n const markdown = [\n '---',\n 'title: Mock Title',\n 'description: Mock Description',\n 'author: Mock Author',\n 'date: 2024-01-01',\n 'tags:',\n ' - tag1',\n ' - tag2',\n ' - tag3',\n '---',\n '# Mock Heading',\n 'This is a mock paragraph with some sample text.',\n 'Here is another mock paragraph.',\n '## Mock Section',\n 'Some more mock content goes here.',\n '### Mock Subsection',\n 'Final mock paragraph with test content.',\n ].join('\\n');\n\n it('should return the metadata from the markdown file', () => {\n const metadata = getMarkdownMetadata(markdown);\n expect(metadata).toEqual({\n title: 'Mock Title',\n description: 'Mock Description',\n author: 'Mock Author',\n date: '2024-01-01',\n tags: ['tag1', 'tag2', 'tag3'],\n });\n });\n});\n"],"mappings":";AAAA,oBAAqC;AACrC,eAAoC;AAAA,IAEpC,wBAAS,uBAAuB,MAAM;AACpC,QAAM,WAAW;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AAEX,wBAAG,qDAAqD,MAAM;AAC5D,UAAM,eAAW,8BAAoB,QAAQ;AAC7C,8BAAO,QAAQ,EAAE,QAAQ;AAAA,MACvB,OAAO;AAAA,MACP,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,MAAM,CAAC,QAAQ,QAAQ,MAAM;AAAA,IAC/B,CAAC;AAAA,EACH,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { getMarkdownMetadata } from "../index.mjs";
|
|
3
|
-
describe("getMarkdownMetadata", () => {
|
|
4
|
-
const markdown = [
|
|
5
|
-
"---",
|
|
6
|
-
"title: Mock Title",
|
|
7
|
-
"description: Mock Description",
|
|
8
|
-
"author: Mock Author",
|
|
9
|
-
"date: 2024-01-01",
|
|
10
|
-
"tags:",
|
|
11
|
-
" - tag1",
|
|
12
|
-
" - tag2",
|
|
13
|
-
" - tag3",
|
|
14
|
-
"---",
|
|
15
|
-
"# Mock Heading",
|
|
16
|
-
"This is a mock paragraph with some sample text.",
|
|
17
|
-
"Here is another mock paragraph.",
|
|
18
|
-
"## Mock Section",
|
|
19
|
-
"Some more mock content goes here.",
|
|
20
|
-
"### Mock Subsection",
|
|
21
|
-
"Final mock paragraph with test content."
|
|
22
|
-
].join("\n");
|
|
23
|
-
it("should return the metadata from the markdown file", () => {
|
|
24
|
-
const metadata = getMarkdownMetadata(markdown);
|
|
25
|
-
expect(metadata).toEqual({
|
|
26
|
-
title: "Mock Title",
|
|
27
|
-
description: "Mock Description",
|
|
28
|
-
author: "Mock Author",
|
|
29
|
-
date: "2024-01-01",
|
|
30
|
-
tags: ["tag1", "tag2", "tag3"]
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=getMarkdownMetadata.test.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/markdown/getMarkdownMetadata.test.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { getMarkdownMetadata } from '..';\n\ndescribe('getMarkdownMetadata', () => {\n const markdown = [\n '---',\n 'title: Mock Title',\n 'description: Mock Description',\n 'author: Mock Author',\n 'date: 2024-01-01',\n 'tags:',\n ' - tag1',\n ' - tag2',\n ' - tag3',\n '---',\n '# Mock Heading',\n 'This is a mock paragraph with some sample text.',\n 'Here is another mock paragraph.',\n '## Mock Section',\n 'Some more mock content goes here.',\n '### Mock Subsection',\n 'Final mock paragraph with test content.',\n ].join('\\n');\n\n it('should return the metadata from the markdown file', () => {\n const metadata = getMarkdownMetadata(markdown);\n expect(metadata).toEqual({\n title: 'Mock Title',\n description: 'Mock Description',\n author: 'Mock Author',\n date: '2024-01-01',\n tags: ['tag1', 'tag2', 'tag3'],\n });\n });\n});\n"],"mappings":"AAAA,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,2BAA2B;AAEpC,SAAS,uBAAuB,MAAM;AACpC,QAAM,WAAW;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AAEX,KAAG,qDAAqD,MAAM;AAC5D,UAAM,WAAW,oBAAoB,QAAQ;AAC7C,WAAO,QAAQ,EAAE,QAAQ;AAAA,MACvB,OAAO;AAAA,MACP,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,MAAM,CAAC,QAAQ,QAAQ,MAAM;AAAA,IAC/B,CAAC;AAAA,EACH,CAAC;AACH,CAAC;","names":[]}
|