recipe-scrapers-js 1.0.0-rc.3 → 1.0.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/CHANGELOG.md +18 -0
- package/dist/index.d.mts +52 -88
- package/dist/index.mjs +3 -4
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,23 @@ All notable changes to this project will be documented in this file.
|
|
|
6
6
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
7
7
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
8
|
|
|
9
|
+
## [1.0.0] - 2026-01-17
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Promote `1.0.0-rc.*` to stable `1.0.0`
|
|
14
|
+
- Update dependencies: `parse-ingredient@^1.3.3`, `zod@^4.3.5`, `tsdown@^0.19.0`, `@biomejs/biome@2.3.11`
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Allow ingredient items to have `parsed: null` when ingredient parsing fails
|
|
19
|
+
|
|
20
|
+
## [1.0.0-rc.4] - 2025-12-21
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Fix `zNonEmptyArray` typing
|
|
25
|
+
|
|
9
26
|
## [1.0.0-rc.3] - 2025-12-21
|
|
10
27
|
|
|
11
28
|
### Changed
|
|
@@ -53,4 +70,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
53
70
|
|
|
54
71
|
Prior to version 1.0.0-rc.0, this project was in alpha development. No formal changelog was maintained during the alpha phase.
|
|
55
72
|
|
|
73
|
+
[1.0.0]: https://github.com/nerdstep/recipe-scrapers-js/releases/tag/v1.0.0
|
|
56
74
|
[1.0.0-rc.0]: https://github.com/nerdstep/recipe-scrapers-js/releases/tag/v1.0.0-rc.0
|
package/dist/index.d.mts
CHANGED
|
@@ -60,41 +60,31 @@ declare const ParsedIngredientSchema: z.ZodObject<{
|
|
|
60
60
|
*/
|
|
61
61
|
declare const IngredientItemSchema: z.ZodObject<{
|
|
62
62
|
value: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
63
|
-
parsed: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
parsed: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
64
64
|
quantity: z.ZodNullable<z.ZodNumber>;
|
|
65
65
|
quantity2: z.ZodNullable<z.ZodNumber>;
|
|
66
66
|
unitOfMeasureID: z.ZodNullable<z.ZodString>;
|
|
67
67
|
unitOfMeasure: z.ZodNullable<z.ZodString>;
|
|
68
68
|
description: z.ZodString;
|
|
69
69
|
isGroupHeader: z.ZodBoolean;
|
|
70
|
-
}, z.core.$strip
|
|
70
|
+
}, z.core.$strip>>>;
|
|
71
71
|
}, z.core.$strip>;
|
|
72
72
|
/**
|
|
73
73
|
* Schema for a group of ingredients
|
|
74
74
|
*/
|
|
75
75
|
declare const IngredientGroupSchema: z.ZodObject<{
|
|
76
76
|
name: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
77
|
-
items: z.ZodArray<z.
|
|
78
|
-
value: string
|
|
79
|
-
parsed
|
|
80
|
-
quantity:
|
|
81
|
-
quantity2:
|
|
82
|
-
unitOfMeasureID:
|
|
83
|
-
unitOfMeasure:
|
|
84
|
-
description:
|
|
85
|
-
isGroupHeader:
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
value: string;
|
|
89
|
-
parsed?: {
|
|
90
|
-
quantity: number | null;
|
|
91
|
-
quantity2: number | null;
|
|
92
|
-
unitOfMeasureID: string | null;
|
|
93
|
-
unitOfMeasure: string | null;
|
|
94
|
-
description: string;
|
|
95
|
-
isGroupHeader: boolean;
|
|
96
|
-
} | undefined;
|
|
97
|
-
}, unknown>>>;
|
|
77
|
+
items: z.ZodArray<z.ZodObject<{
|
|
78
|
+
value: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
79
|
+
parsed: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
80
|
+
quantity: z.ZodNullable<z.ZodNumber>;
|
|
81
|
+
quantity2: z.ZodNullable<z.ZodNumber>;
|
|
82
|
+
unitOfMeasureID: z.ZodNullable<z.ZodString>;
|
|
83
|
+
unitOfMeasure: z.ZodNullable<z.ZodString>;
|
|
84
|
+
description: z.ZodString;
|
|
85
|
+
isGroupHeader: z.ZodBoolean;
|
|
86
|
+
}, z.core.$strip>>>;
|
|
87
|
+
}, z.core.$strip>>;
|
|
98
88
|
}, z.core.$strip>;
|
|
99
89
|
/**
|
|
100
90
|
* Schema for all recipe ingredients
|
|
@@ -102,27 +92,17 @@ declare const IngredientGroupSchema: z.ZodObject<{
|
|
|
102
92
|
*/
|
|
103
93
|
declare const IngredientsSchema: z.ZodArray<z.ZodObject<{
|
|
104
94
|
name: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
105
|
-
items: z.ZodArray<z.
|
|
106
|
-
value: string
|
|
107
|
-
parsed
|
|
108
|
-
quantity:
|
|
109
|
-
quantity2:
|
|
110
|
-
unitOfMeasureID:
|
|
111
|
-
unitOfMeasure:
|
|
112
|
-
description:
|
|
113
|
-
isGroupHeader:
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
value: string;
|
|
117
|
-
parsed?: {
|
|
118
|
-
quantity: number | null;
|
|
119
|
-
quantity2: number | null;
|
|
120
|
-
unitOfMeasureID: string | null;
|
|
121
|
-
unitOfMeasure: string | null;
|
|
122
|
-
description: string;
|
|
123
|
-
isGroupHeader: boolean;
|
|
124
|
-
} | undefined;
|
|
125
|
-
}, unknown>>>;
|
|
95
|
+
items: z.ZodArray<z.ZodObject<{
|
|
96
|
+
value: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
97
|
+
parsed: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
98
|
+
quantity: z.ZodNullable<z.ZodNumber>;
|
|
99
|
+
quantity2: z.ZodNullable<z.ZodNumber>;
|
|
100
|
+
unitOfMeasureID: z.ZodNullable<z.ZodString>;
|
|
101
|
+
unitOfMeasure: z.ZodNullable<z.ZodString>;
|
|
102
|
+
description: z.ZodString;
|
|
103
|
+
isGroupHeader: z.ZodBoolean;
|
|
104
|
+
}, z.core.$strip>>>;
|
|
105
|
+
}, z.core.$strip>>;
|
|
126
106
|
}, z.core.$strip>>;
|
|
127
107
|
/**
|
|
128
108
|
* Schema for a single instruction step
|
|
@@ -135,11 +115,9 @@ declare const InstructionItemSchema: z.ZodObject<{
|
|
|
135
115
|
*/
|
|
136
116
|
declare const InstructionGroupSchema: z.ZodObject<{
|
|
137
117
|
name: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
138
|
-
items: z.ZodArray<z.
|
|
139
|
-
value: string
|
|
140
|
-
},
|
|
141
|
-
value: string;
|
|
142
|
-
}, unknown>>>;
|
|
118
|
+
items: z.ZodArray<z.ZodObject<{
|
|
119
|
+
value: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
120
|
+
}, z.core.$strip>>;
|
|
143
121
|
}, z.core.$strip>;
|
|
144
122
|
/**
|
|
145
123
|
* Schema for all recipe instructions
|
|
@@ -147,11 +125,9 @@ declare const InstructionGroupSchema: z.ZodObject<{
|
|
|
147
125
|
*/
|
|
148
126
|
declare const InstructionsSchema: z.ZodArray<z.ZodObject<{
|
|
149
127
|
name: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
150
|
-
items: z.ZodArray<z.
|
|
151
|
-
value: string
|
|
152
|
-
},
|
|
153
|
-
value: string;
|
|
154
|
-
}, unknown>>>;
|
|
128
|
+
items: z.ZodArray<z.ZodObject<{
|
|
129
|
+
value: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
130
|
+
}, z.core.$strip>>;
|
|
155
131
|
}, z.core.$strip>>;
|
|
156
132
|
/**
|
|
157
133
|
* Schema for a link object
|
|
@@ -183,35 +159,23 @@ declare const RecipeObjectBaseSchema: z.ZodObject<{
|
|
|
183
159
|
author: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
184
160
|
ingredients: z.ZodArray<z.ZodObject<{
|
|
185
161
|
name: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
186
|
-
items: z.ZodArray<z.
|
|
187
|
-
value: string
|
|
188
|
-
parsed
|
|
189
|
-
quantity:
|
|
190
|
-
quantity2:
|
|
191
|
-
unitOfMeasureID:
|
|
192
|
-
unitOfMeasure:
|
|
193
|
-
description:
|
|
194
|
-
isGroupHeader:
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
value: string;
|
|
198
|
-
parsed?: {
|
|
199
|
-
quantity: number | null;
|
|
200
|
-
quantity2: number | null;
|
|
201
|
-
unitOfMeasureID: string | null;
|
|
202
|
-
unitOfMeasure: string | null;
|
|
203
|
-
description: string;
|
|
204
|
-
isGroupHeader: boolean;
|
|
205
|
-
} | undefined;
|
|
206
|
-
}, unknown>>>;
|
|
162
|
+
items: z.ZodArray<z.ZodObject<{
|
|
163
|
+
value: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
164
|
+
parsed: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
165
|
+
quantity: z.ZodNullable<z.ZodNumber>;
|
|
166
|
+
quantity2: z.ZodNullable<z.ZodNumber>;
|
|
167
|
+
unitOfMeasureID: z.ZodNullable<z.ZodString>;
|
|
168
|
+
unitOfMeasure: z.ZodNullable<z.ZodString>;
|
|
169
|
+
description: z.ZodString;
|
|
170
|
+
isGroupHeader: z.ZodBoolean;
|
|
171
|
+
}, z.core.$strip>>>;
|
|
172
|
+
}, z.core.$strip>>;
|
|
207
173
|
}, z.core.$strip>>;
|
|
208
174
|
instructions: z.ZodArray<z.ZodObject<{
|
|
209
175
|
name: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
210
|
-
items: z.ZodArray<z.
|
|
211
|
-
value: string
|
|
212
|
-
},
|
|
213
|
-
value: string;
|
|
214
|
-
}, unknown>>>;
|
|
176
|
+
items: z.ZodArray<z.ZodObject<{
|
|
177
|
+
value: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
178
|
+
}, z.core.$strip>>;
|
|
215
179
|
}, z.core.$strip>>;
|
|
216
180
|
canonicalUrl: z.ZodURL;
|
|
217
181
|
image: z.ZodURL;
|
|
@@ -278,7 +242,7 @@ declare const RecipeObjectSchema: z.ZodPipe<z.ZodType<{
|
|
|
278
242
|
unitOfMeasure: string | null;
|
|
279
243
|
description: string;
|
|
280
244
|
isGroupHeader: boolean;
|
|
281
|
-
} | undefined;
|
|
245
|
+
} | null | undefined;
|
|
282
246
|
}[];
|
|
283
247
|
}[];
|
|
284
248
|
instructions: {
|
|
@@ -326,7 +290,7 @@ declare const RecipeObjectSchema: z.ZodPipe<z.ZodType<{
|
|
|
326
290
|
unitOfMeasure: string | null;
|
|
327
291
|
description: string;
|
|
328
292
|
isGroupHeader: boolean;
|
|
329
|
-
} | undefined;
|
|
293
|
+
} | null | undefined;
|
|
330
294
|
}[];
|
|
331
295
|
}[];
|
|
332
296
|
instructions: {
|
|
@@ -374,7 +338,7 @@ declare const RecipeObjectSchema: z.ZodPipe<z.ZodType<{
|
|
|
374
338
|
unitOfMeasure: string | null;
|
|
375
339
|
description: string;
|
|
376
340
|
isGroupHeader: boolean;
|
|
377
|
-
} | undefined;
|
|
341
|
+
} | null | undefined;
|
|
378
342
|
}[];
|
|
379
343
|
}[];
|
|
380
344
|
instructions: {
|
|
@@ -422,7 +386,7 @@ declare const RecipeObjectSchema: z.ZodPipe<z.ZodType<{
|
|
|
422
386
|
unitOfMeasure: string | null;
|
|
423
387
|
description: string;
|
|
424
388
|
isGroupHeader: boolean;
|
|
425
|
-
} | undefined;
|
|
389
|
+
} | null | undefined;
|
|
426
390
|
}[];
|
|
427
391
|
}[];
|
|
428
392
|
instructions: {
|
|
@@ -860,7 +824,7 @@ declare abstract class AbstractScraper {
|
|
|
860
824
|
unitOfMeasure: string | null;
|
|
861
825
|
description: string;
|
|
862
826
|
isGroupHeader: boolean;
|
|
863
|
-
} | undefined;
|
|
827
|
+
} | null | undefined;
|
|
864
828
|
}[];
|
|
865
829
|
}[];
|
|
866
830
|
instructions: {
|
|
@@ -908,7 +872,7 @@ declare abstract class AbstractScraper {
|
|
|
908
872
|
unitOfMeasure: string | null;
|
|
909
873
|
description: string;
|
|
910
874
|
isGroupHeader: boolean;
|
|
911
|
-
} | undefined;
|
|
875
|
+
} | null | undefined;
|
|
912
876
|
}[];
|
|
913
877
|
}[];
|
|
914
878
|
instructions: {
|
|
@@ -956,7 +920,7 @@ declare abstract class AbstractScraper {
|
|
|
956
920
|
unitOfMeasure: string | null;
|
|
957
921
|
description: string;
|
|
958
922
|
isGroupHeader: boolean;
|
|
959
|
-
} | undefined;
|
|
923
|
+
} | null | undefined;
|
|
960
924
|
}[];
|
|
961
925
|
}[];
|
|
962
926
|
instructions: {
|
|
@@ -1004,7 +968,7 @@ declare abstract class AbstractScraper {
|
|
|
1004
968
|
unitOfMeasure: string | null;
|
|
1005
969
|
description: string;
|
|
1006
970
|
isGroupHeader: boolean;
|
|
1007
|
-
} | undefined;
|
|
971
|
+
} | null | undefined;
|
|
1008
972
|
}[];
|
|
1009
973
|
}[];
|
|
1010
974
|
instructions: {
|
package/dist/index.mjs
CHANGED
|
@@ -81,7 +81,7 @@ const ParsedIngredientSchema = z.object({
|
|
|
81
81
|
*/
|
|
82
82
|
const IngredientItemSchema = z.object({
|
|
83
83
|
value: zString("Ingredient value"),
|
|
84
|
-
parsed: ParsedIngredientSchema.optional()
|
|
84
|
+
parsed: ParsedIngredientSchema.optional().nullable()
|
|
85
85
|
});
|
|
86
86
|
/**
|
|
87
87
|
* Schema for a group of ingredients
|
|
@@ -585,11 +585,10 @@ var IngredientParserPlugin = class extends PostProcessorPlugin {
|
|
|
585
585
|
}));
|
|
586
586
|
}
|
|
587
587
|
parseItem(item) {
|
|
588
|
-
const
|
|
589
|
-
if (!result) return item;
|
|
588
|
+
const parsedIngredient = parseIngredient(item.value, this.options)[0] ?? null;
|
|
590
589
|
return {
|
|
591
590
|
value: item.value,
|
|
592
|
-
parsed:
|
|
591
|
+
parsed: parsedIngredient
|
|
593
592
|
};
|
|
594
593
|
}
|
|
595
594
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "recipe-scrapers-js",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A recipe scrapers library",
|
|
6
6
|
"author": {
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"iso8601-duration": "^2.1.3",
|
|
56
|
-
"parse-ingredient": "^1.3.
|
|
56
|
+
"parse-ingredient": "^1.3.3",
|
|
57
57
|
"schema-dts": "^1.1.5"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@biomejs/biome": "2.3.
|
|
60
|
+
"@biomejs/biome": "2.3.11",
|
|
61
61
|
"@types/bun": "^1.3.0",
|
|
62
62
|
"cheerio": "^1.1.2",
|
|
63
|
-
"tsdown": "^0.
|
|
63
|
+
"tsdown": "^0.19.0",
|
|
64
64
|
"typescript": "^5.9.3",
|
|
65
|
-
"zod": "^4.
|
|
65
|
+
"zod": "^4.3.5"
|
|
66
66
|
}
|
|
67
67
|
}
|