@purescraps/purehtml 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/.eslintrc.json +21 -0
- package/.prettierrc +3 -0
- package/README.md +75 -0
- package/config.yaml +0 -0
- package/dist/examples/simple.d.ts +2 -0
- package/dist/examples/simple.js +7586 -0
- package/dist/examples/simple.js.map +1 -0
- package/dist/src/index.d.ts +24 -0
- package/dist/src/index.js +7586 -0
- package/dist/src/index.js.map +1 -0
- package/examples/simple.html +26 -0
- package/examples/simple.ts +12 -0
- package/examples/simple.yaml +20 -0
- package/jest.config.ts +9 -0
- package/package.json +36 -0
- package/sample.html +0 -0
- package/src/config/config.ts +12 -0
- package/src/config/factory.ts +142 -0
- package/src/config/index.ts +6 -0
- package/src/config/plain-config.ts +19 -0
- package/src/config/types/array.test.ts +103 -0
- package/src/config/types/array.ts +61 -0
- package/src/config/types/constant.ts +15 -0
- package/src/config/types/object.test.ts +99 -0
- package/src/config/types/object.ts +65 -0
- package/src/config/types/primitive.ts +63 -0
- package/src/config/types/union.ts +36 -0
- package/src/config/types/with-selector.test.ts +32 -0
- package/src/config/types/with-selector.ts +26 -0
- package/src/config/validator.ts +14 -0
- package/src/config-schema.json +144 -0
- package/src/config-schema.test.ts +187 -0
- package/src/core/argument-types.ts +21 -0
- package/src/core/complex-types.ts +4 -0
- package/src/core/primitive-types.ts +5 -0
- package/src/core/property.ts +3 -0
- package/src/core/transformer.ts +21 -0
- package/src/errors/invalid-parse-input-error.ts +7 -0
- package/src/index.ts +26 -0
- package/src/jest.d.ts +5 -0
- package/src/setup-jest-matchers.ts +26 -0
- package/src/transformers/attr.ts +49 -0
- package/src/transformers/exists.ts +20 -0
- package/src/transformers/factory.test.ts +17 -0
- package/src/transformers/factory.ts +54 -0
- package/src/transformers/html.ts +20 -0
- package/src/transformers/index.ts +9 -0
- package/src/transformers/length.ts +28 -0
- package/src/transformers/match-count.ts +20 -0
- package/src/transformers/number.ts +30 -0
- package/src/transformers/resolve.ts +29 -0
- package/src/transformers/transformers.ts +27 -0
- package/src/transformers/trim.ts +32 -0
- package/src/transformers/url-query-param.ts +65 -0
- package/tests/config/constant.test.ts +23 -0
- package/tests/extract.test.ts +21 -0
- package/tests/fixtures/basic.html +16 -0
- package/tests/transformers/attr.test.ts +146 -0
- package/tests/transformers/html.test.ts +25 -0
- package/tests/transformers/url-query-param.test.ts +85 -0
- package/tsconfig.json +10 -0
- package/tsup.config.ts +12 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const rootProp: unique symbol;
|
|
2
|
+
type Property = typeof rootProp | string;
|
|
3
|
+
|
|
4
|
+
interface ExtractParams {
|
|
5
|
+
$: cheerio.Root;
|
|
6
|
+
$el: cheerio.Cheerio;
|
|
7
|
+
url: string;
|
|
8
|
+
property: Property;
|
|
9
|
+
}
|
|
10
|
+
declare abstract class Config<T = unknown> {
|
|
11
|
+
abstract extract(params: ExtractParams): T;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare class ConfigFactory {
|
|
15
|
+
static fromYAML(yaml: string): Config;
|
|
16
|
+
private static generate;
|
|
17
|
+
private static generateSelector;
|
|
18
|
+
private static generateTransform;
|
|
19
|
+
private static detectExpectedType;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare function extract<T = unknown>($: cheerio.Root | string, config: Config<T>, url: string): T;
|
|
23
|
+
|
|
24
|
+
export { ConfigFactory, extract };
|