@well-known-js/core 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/LICENSE +21 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +14 -0
- package/package.json +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bryan Ledda
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface WellKnownGeneratedFile {
|
|
2
|
+
path: `/.well-known/${string}`;
|
|
3
|
+
filename: string;
|
|
4
|
+
contentType: string;
|
|
5
|
+
body: string;
|
|
6
|
+
}
|
|
7
|
+
interface WellKnownProvider<TConfig = unknown> {
|
|
8
|
+
name: string;
|
|
9
|
+
path: `/.well-known/${string}`;
|
|
10
|
+
generate(config: TConfig): WellKnownGeneratedFile;
|
|
11
|
+
}
|
|
12
|
+
interface WellKnownProviderInstance {
|
|
13
|
+
name: string;
|
|
14
|
+
path: `/.well-known/${string}`;
|
|
15
|
+
generate(): WellKnownGeneratedFile;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface WellKnownConfig {
|
|
19
|
+
providers: WellKnownProviderInstance[];
|
|
20
|
+
}
|
|
21
|
+
declare function defineConfig(config: WellKnownConfig): WellKnownConfig;
|
|
22
|
+
|
|
23
|
+
export { type WellKnownConfig, type WellKnownGeneratedFile, type WellKnownProvider, type WellKnownProviderInstance, defineConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
function defineConfig(config) {
|
|
3
|
+
const paths = /* @__PURE__ */ new Set();
|
|
4
|
+
for (const provider of config.providers) {
|
|
5
|
+
if (paths.has(provider.path)) {
|
|
6
|
+
throw new Error(`Duplicate well-known provider path: ${provider.path}`);
|
|
7
|
+
}
|
|
8
|
+
paths.add(provider.path);
|
|
9
|
+
}
|
|
10
|
+
return config;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
defineConfig
|
|
14
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@well-known-js/core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Core utilities and types for generating .well-known files.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/louchebem06/well-known.git",
|
|
9
|
+
"directory": "packages/core"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=20"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsup src/index.ts --tsconfig tsconfig.build.json --format esm --dts --clean",
|
|
31
|
+
"dev": "tsup src/index.ts --tsconfig tsconfig.build.json --format esm --dts --watch",
|
|
32
|
+
"typecheck": "tsc -b",
|
|
33
|
+
"test": "vitest run --passWithNoTests",
|
|
34
|
+
"test:watch": "vitest",
|
|
35
|
+
"test:coverage": "vitest run --coverage"
|
|
36
|
+
}
|
|
37
|
+
}
|