@richie-router/server 0.0.1 → 0.1.2

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.
@@ -0,0 +1,252 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ function __accessProp(key) {
6
+ return this[key];
7
+ }
8
+ var __toCommonJS = (from) => {
9
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
10
+ if (entry)
11
+ return entry;
12
+ entry = __defProp({}, "__esModule", { value: true });
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (var key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(entry, key))
16
+ __defProp(entry, key, {
17
+ get: __accessProp.bind(from, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ __moduleCache.set(from, entry);
22
+ return entry;
23
+ };
24
+ var __moduleCache;
25
+ var __returnValue = (v) => v;
26
+ function __exportSetter(name, newValue) {
27
+ this[name] = __returnValue.bind(null, newValue);
28
+ }
29
+ var __export = (target, all) => {
30
+ for (var name in all)
31
+ __defProp(target, name, {
32
+ get: all[name],
33
+ enumerable: true,
34
+ configurable: true,
35
+ set: __exportSetter.bind(all, name)
36
+ });
37
+ };
38
+
39
+ // packages/server/src/index.ts
40
+ var exports_src = {};
41
+ __export(exports_src, {
42
+ handleRequest: () => handleRequest,
43
+ handleHeadTagRequest: () => handleHeadTagRequest,
44
+ defineHeadTags: () => defineHeadTags
45
+ });
46
+ module.exports = __toCommonJS(exports_src);
47
+ var import_core = require("@richie-router/core");
48
+ function defineHeadTags(routeManifest, headTagSchema, definitions) {
49
+ return {
50
+ routeManifest,
51
+ headTagSchema,
52
+ definitions
53
+ };
54
+ }
55
+ var HEAD_PLACEHOLDER = "<!--richie-router-head-->";
56
+ var MANAGED_HEAD_ATTRIBUTE = "data-richie-router-head";
57
+ function routeHasRecord(value) {
58
+ return typeof value === "object" && value !== null;
59
+ }
60
+ function createHeadSnapshotScript(href, head) {
61
+ const payload = JSON.stringify({ href, head }).replaceAll("</script>", "<\\/script>");
62
+ return `<script ${MANAGED_HEAD_ATTRIBUTE}="true">window.__RICHIE_ROUTER_HEAD__=${payload}</script>`;
63
+ }
64
+ async function renderTemplate(html, ctx) {
65
+ const template = html.template;
66
+ if (typeof template === "function") {
67
+ return await template(ctx);
68
+ }
69
+ if (!template.includes(HEAD_PLACEHOLDER)) {
70
+ throw new Error(`HTML template is missing required Richie Router placeholder: ${HEAD_PLACEHOLDER}`);
71
+ }
72
+ return template.replace(HEAD_PLACEHOLDER, ctx.richieRouterHead);
73
+ }
74
+ function jsonResponse(data, init) {
75
+ return new Response(JSON.stringify(data), {
76
+ ...init,
77
+ headers: {
78
+ "content-type": "application/json; charset=utf-8",
79
+ ...init?.headers ?? {}
80
+ }
81
+ });
82
+ }
83
+ function resolveSearch(route, rawSearch) {
84
+ const fromSchema = route.searchSchema ? route.searchSchema.parse(rawSearch) : {};
85
+ if (routeHasRecord(fromSchema)) {
86
+ return fromSchema;
87
+ }
88
+ return rawSearch;
89
+ }
90
+ function buildMatches(routeManifest, location) {
91
+ const matched = import_core.matchRouteTree(routeManifest, location.pathname);
92
+ if (!matched) {
93
+ return [];
94
+ }
95
+ const rawSearch = location.search;
96
+ let accumulatedSearch = { ...rawSearch };
97
+ return matched.map(({ route, params }) => {
98
+ const nextSearch = resolveSearch(route, rawSearch);
99
+ if (routeHasRecord(nextSearch)) {
100
+ accumulatedSearch = {
101
+ ...accumulatedSearch,
102
+ ...nextSearch
103
+ };
104
+ }
105
+ return {
106
+ id: route.fullPath,
107
+ pathname: location.pathname,
108
+ params,
109
+ route,
110
+ search: accumulatedSearch,
111
+ to: route.to
112
+ };
113
+ });
114
+ }
115
+ async function executeHeadTag(request, headTags, headTagName, params, rawSearch) {
116
+ const definition = headTags.definitions[headTagName];
117
+ const schemaEntry = headTags.headTagSchema[headTagName];
118
+ if (!definition) {
119
+ throw new Error(`Unknown head tag "${headTagName}".`);
120
+ }
121
+ const search = schemaEntry?.searchSchema ? schemaEntry.searchSchema.parse(rawSearch) : rawSearch;
122
+ const head = await definition.head({
123
+ request,
124
+ params,
125
+ search
126
+ });
127
+ return {
128
+ head,
129
+ staleTime: definition.staleTime
130
+ };
131
+ }
132
+ async function resolveMatchedHead(request, headTags, matches) {
133
+ const resolvedHeadByRoute = new Map;
134
+ for (const match of matches) {
135
+ const headOption = match.route.options.head;
136
+ if (typeof headOption !== "string") {
137
+ continue;
138
+ }
139
+ const result = await executeHeadTag(request, headTags, headOption, match.params, match.search);
140
+ resolvedHeadByRoute.set(match.route.fullPath, result.head);
141
+ }
142
+ return import_core.resolveHeadConfig(matches, resolvedHeadByRoute);
143
+ }
144
+ async function handleHeadTagRequest(request, options) {
145
+ const url = new URL(request.url);
146
+ const headBasePath = options.headBasePath ?? "/head-api";
147
+ if (!url.pathname.startsWith(`${headBasePath}/`)) {
148
+ return {
149
+ matched: false,
150
+ response: new Response("Not Found", { status: 404 })
151
+ };
152
+ }
153
+ const headTagName = decodeURIComponent(url.pathname.slice(headBasePath.length + 1));
154
+ const params = JSON.parse(url.searchParams.get("params") ?? "{}");
155
+ const search = JSON.parse(url.searchParams.get("search") ?? "{}");
156
+ try {
157
+ const result = await executeHeadTag(request, options.headTags, headTagName, params, search);
158
+ return {
159
+ matched: true,
160
+ response: jsonResponse(result)
161
+ };
162
+ } catch (error) {
163
+ if (error instanceof Response) {
164
+ return {
165
+ matched: true,
166
+ response: error
167
+ };
168
+ }
169
+ if (import_core.isNotFound(error)) {
170
+ return {
171
+ matched: true,
172
+ response: jsonResponse({ message: "Not Found" }, { status: 404 })
173
+ };
174
+ }
175
+ throw error;
176
+ }
177
+ }
178
+ async function handleRequest(request, options) {
179
+ const url = new URL(request.url);
180
+ const routeBasePath = options.routeBasePath ?? "/";
181
+ const handledHeadTagRequest = await handleHeadTagRequest(request, {
182
+ headTags: options.headTags,
183
+ headBasePath: options.headBasePath
184
+ });
185
+ if (handledHeadTagRequest.matched) {
186
+ return handledHeadTagRequest;
187
+ }
188
+ if (!url.pathname.startsWith(routeBasePath)) {
189
+ return {
190
+ matched: false,
191
+ response: new Response("Not Found", { status: 404 })
192
+ };
193
+ }
194
+ const location = import_core.createParsedLocation(`${url.pathname}${url.search}${url.hash}`, null, import_core.defaultParseSearch);
195
+ const matches = buildMatches(options.routeManifest, location);
196
+ if (matches.length === 0) {
197
+ return {
198
+ matched: false,
199
+ response: new Response("Not Found", { status: 404 })
200
+ };
201
+ }
202
+ try {
203
+ const head = await resolveMatchedHead(request, options.headTags, matches);
204
+ const headHtml = import_core.serializeHeadConfig(head, {
205
+ managedAttribute: MANAGED_HEAD_ATTRIBUTE
206
+ });
207
+ const richieRouterHead = `${headHtml}${createHeadSnapshotScript(location.href, head)}`;
208
+ const html = await renderTemplate(options.html, {
209
+ request,
210
+ richieRouterHead,
211
+ head
212
+ });
213
+ return {
214
+ matched: true,
215
+ response: new Response(html, {
216
+ status: 200,
217
+ headers: {
218
+ "content-type": "text/html; charset=utf-8"
219
+ }
220
+ })
221
+ };
222
+ } catch (error) {
223
+ if (import_core.isRedirect(error)) {
224
+ const redirectPath = import_core.buildPath(error.options.to, error.options.params ?? {});
225
+ const redirectSearch = import_core.defaultStringifySearch(error.options.search === true ? {} : error.options.search ?? {});
226
+ const redirectHash = error.options.hash ? `#${error.options.hash.replace(/^#/, "")}` : "";
227
+ const redirectUrl = `${redirectPath}${redirectSearch}${redirectHash}`;
228
+ return {
229
+ matched: true,
230
+ response: new Response(null, {
231
+ status: error.options.replace ? 307 : 302,
232
+ headers: {
233
+ location: redirectUrl
234
+ }
235
+ })
236
+ };
237
+ }
238
+ if (error instanceof Response) {
239
+ return {
240
+ matched: true,
241
+ response: error
242
+ };
243
+ }
244
+ if (import_core.isNotFound(error)) {
245
+ return {
246
+ matched: true,
247
+ response: new Response("Not Found", { status: 404 })
248
+ };
249
+ }
250
+ throw error;
251
+ }
252
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,222 @@
1
+ // packages/server/src/index.ts
2
+ import {
3
+ buildPath,
4
+ createParsedLocation,
5
+ defaultParseSearch,
6
+ defaultStringifySearch,
7
+ isNotFound,
8
+ isRedirect,
9
+ matchRouteTree,
10
+ resolveHeadConfig,
11
+ serializeHeadConfig
12
+ } from "@richie-router/core";
13
+ function defineHeadTags(routeManifest, headTagSchema, definitions) {
14
+ return {
15
+ routeManifest,
16
+ headTagSchema,
17
+ definitions
18
+ };
19
+ }
20
+ var HEAD_PLACEHOLDER = "<!--richie-router-head-->";
21
+ var MANAGED_HEAD_ATTRIBUTE = "data-richie-router-head";
22
+ function routeHasRecord(value) {
23
+ return typeof value === "object" && value !== null;
24
+ }
25
+ function createHeadSnapshotScript(href, head) {
26
+ const payload = JSON.stringify({ href, head }).replaceAll("</script>", "<\\/script>");
27
+ return `<script ${MANAGED_HEAD_ATTRIBUTE}="true">window.__RICHIE_ROUTER_HEAD__=${payload}</script>`;
28
+ }
29
+ async function renderTemplate(html, ctx) {
30
+ const template = html.template;
31
+ if (typeof template === "function") {
32
+ return await template(ctx);
33
+ }
34
+ if (!template.includes(HEAD_PLACEHOLDER)) {
35
+ throw new Error(`HTML template is missing required Richie Router placeholder: ${HEAD_PLACEHOLDER}`);
36
+ }
37
+ return template.replace(HEAD_PLACEHOLDER, ctx.richieRouterHead);
38
+ }
39
+ function jsonResponse(data, init) {
40
+ return new Response(JSON.stringify(data), {
41
+ ...init,
42
+ headers: {
43
+ "content-type": "application/json; charset=utf-8",
44
+ ...init?.headers ?? {}
45
+ }
46
+ });
47
+ }
48
+ function resolveSearch(route, rawSearch) {
49
+ const fromSchema = route.searchSchema ? route.searchSchema.parse(rawSearch) : {};
50
+ if (routeHasRecord(fromSchema)) {
51
+ return fromSchema;
52
+ }
53
+ return rawSearch;
54
+ }
55
+ function buildMatches(routeManifest, location) {
56
+ const matched = matchRouteTree(routeManifest, location.pathname);
57
+ if (!matched) {
58
+ return [];
59
+ }
60
+ const rawSearch = location.search;
61
+ let accumulatedSearch = { ...rawSearch };
62
+ return matched.map(({ route, params }) => {
63
+ const nextSearch = resolveSearch(route, rawSearch);
64
+ if (routeHasRecord(nextSearch)) {
65
+ accumulatedSearch = {
66
+ ...accumulatedSearch,
67
+ ...nextSearch
68
+ };
69
+ }
70
+ return {
71
+ id: route.fullPath,
72
+ pathname: location.pathname,
73
+ params,
74
+ route,
75
+ search: accumulatedSearch,
76
+ to: route.to
77
+ };
78
+ });
79
+ }
80
+ async function executeHeadTag(request, headTags, headTagName, params, rawSearch) {
81
+ const definition = headTags.definitions[headTagName];
82
+ const schemaEntry = headTags.headTagSchema[headTagName];
83
+ if (!definition) {
84
+ throw new Error(`Unknown head tag "${headTagName}".`);
85
+ }
86
+ const search = schemaEntry?.searchSchema ? schemaEntry.searchSchema.parse(rawSearch) : rawSearch;
87
+ const head = await definition.head({
88
+ request,
89
+ params,
90
+ search
91
+ });
92
+ return {
93
+ head,
94
+ staleTime: definition.staleTime
95
+ };
96
+ }
97
+ async function resolveMatchedHead(request, headTags, matches) {
98
+ const resolvedHeadByRoute = new Map;
99
+ for (const match of matches) {
100
+ const headOption = match.route.options.head;
101
+ if (typeof headOption !== "string") {
102
+ continue;
103
+ }
104
+ const result = await executeHeadTag(request, headTags, headOption, match.params, match.search);
105
+ resolvedHeadByRoute.set(match.route.fullPath, result.head);
106
+ }
107
+ return resolveHeadConfig(matches, resolvedHeadByRoute);
108
+ }
109
+ async function handleHeadTagRequest(request, options) {
110
+ const url = new URL(request.url);
111
+ const headBasePath = options.headBasePath ?? "/head-api";
112
+ if (!url.pathname.startsWith(`${headBasePath}/`)) {
113
+ return {
114
+ matched: false,
115
+ response: new Response("Not Found", { status: 404 })
116
+ };
117
+ }
118
+ const headTagName = decodeURIComponent(url.pathname.slice(headBasePath.length + 1));
119
+ const params = JSON.parse(url.searchParams.get("params") ?? "{}");
120
+ const search = JSON.parse(url.searchParams.get("search") ?? "{}");
121
+ try {
122
+ const result = await executeHeadTag(request, options.headTags, headTagName, params, search);
123
+ return {
124
+ matched: true,
125
+ response: jsonResponse(result)
126
+ };
127
+ } catch (error) {
128
+ if (error instanceof Response) {
129
+ return {
130
+ matched: true,
131
+ response: error
132
+ };
133
+ }
134
+ if (isNotFound(error)) {
135
+ return {
136
+ matched: true,
137
+ response: jsonResponse({ message: "Not Found" }, { status: 404 })
138
+ };
139
+ }
140
+ throw error;
141
+ }
142
+ }
143
+ async function handleRequest(request, options) {
144
+ const url = new URL(request.url);
145
+ const routeBasePath = options.routeBasePath ?? "/";
146
+ const handledHeadTagRequest = await handleHeadTagRequest(request, {
147
+ headTags: options.headTags,
148
+ headBasePath: options.headBasePath
149
+ });
150
+ if (handledHeadTagRequest.matched) {
151
+ return handledHeadTagRequest;
152
+ }
153
+ if (!url.pathname.startsWith(routeBasePath)) {
154
+ return {
155
+ matched: false,
156
+ response: new Response("Not Found", { status: 404 })
157
+ };
158
+ }
159
+ const location = createParsedLocation(`${url.pathname}${url.search}${url.hash}`, null, defaultParseSearch);
160
+ const matches = buildMatches(options.routeManifest, location);
161
+ if (matches.length === 0) {
162
+ return {
163
+ matched: false,
164
+ response: new Response("Not Found", { status: 404 })
165
+ };
166
+ }
167
+ try {
168
+ const head = await resolveMatchedHead(request, options.headTags, matches);
169
+ const headHtml = serializeHeadConfig(head, {
170
+ managedAttribute: MANAGED_HEAD_ATTRIBUTE
171
+ });
172
+ const richieRouterHead = `${headHtml}${createHeadSnapshotScript(location.href, head)}`;
173
+ const html = await renderTemplate(options.html, {
174
+ request,
175
+ richieRouterHead,
176
+ head
177
+ });
178
+ return {
179
+ matched: true,
180
+ response: new Response(html, {
181
+ status: 200,
182
+ headers: {
183
+ "content-type": "text/html; charset=utf-8"
184
+ }
185
+ })
186
+ };
187
+ } catch (error) {
188
+ if (isRedirect(error)) {
189
+ const redirectPath = buildPath(error.options.to, error.options.params ?? {});
190
+ const redirectSearch = defaultStringifySearch(error.options.search === true ? {} : error.options.search ?? {});
191
+ const redirectHash = error.options.hash ? `#${error.options.hash.replace(/^#/, "")}` : "";
192
+ const redirectUrl = `${redirectPath}${redirectSearch}${redirectHash}`;
193
+ return {
194
+ matched: true,
195
+ response: new Response(null, {
196
+ status: error.options.replace ? 307 : 302,
197
+ headers: {
198
+ location: redirectUrl
199
+ }
200
+ })
201
+ };
202
+ }
203
+ if (error instanceof Response) {
204
+ return {
205
+ matched: true,
206
+ response: error
207
+ };
208
+ }
209
+ if (isNotFound(error)) {
210
+ return {
211
+ matched: true,
212
+ response: new Response("Not Found", { status: 404 })
213
+ };
214
+ }
215
+ throw error;
216
+ }
217
+ }
218
+ export {
219
+ handleRequest,
220
+ handleHeadTagRequest,
221
+ defineHeadTags
222
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,44 @@
1
+ import { type AnyRoute, type HeadConfig, type HeadTagSchemaShape, type InferHeadTagSearchSchema } from '@richie-router/core';
2
+ export interface HeadTagContext<TSearch> {
3
+ request: Request;
4
+ params: Record<string, string>;
5
+ search: TSearch;
6
+ }
7
+ export interface HeadTagDefinition<TSearch> {
8
+ staleTime?: number;
9
+ head: (ctx: HeadTagContext<TSearch>) => Promise<HeadConfig> | HeadConfig;
10
+ }
11
+ export interface DefinedHeadTags<TRouteManifest extends AnyRoute, THeadTagSchema extends HeadTagSchemaShape, TDefinitions extends Partial<{
12
+ [THeadTagName in keyof THeadTagSchema]: HeadTagDefinition<InferHeadTagSearchSchema<THeadTagSchema, THeadTagName>>;
13
+ }>> {
14
+ routeManifest: TRouteManifest;
15
+ headTagSchema: THeadTagSchema;
16
+ definitions: TDefinitions;
17
+ }
18
+ export declare function defineHeadTags<TRouteManifest extends AnyRoute, THeadTagSchema extends HeadTagSchemaShape, TDefinitions extends Partial<{
19
+ [THeadTagName in keyof THeadTagSchema]: HeadTagDefinition<InferHeadTagSearchSchema<THeadTagSchema, THeadTagName>>;
20
+ }>>(routeManifest: TRouteManifest, headTagSchema: THeadTagSchema, definitions: TDefinitions): DefinedHeadTags<TRouteManifest, THeadTagSchema, TDefinitions>;
21
+ export interface HtmlOptions {
22
+ template: string | ((ctx: {
23
+ request: Request;
24
+ richieRouterHead: string;
25
+ head: HeadConfig;
26
+ }) => string | Promise<string>);
27
+ }
28
+ export interface HandleRequestOptions<TRouteManifest extends AnyRoute, THeadTagSchema extends HeadTagSchemaShape, TDefinitions extends Partial<Record<keyof THeadTagSchema, HeadTagDefinition<any>>>> {
29
+ routeManifest: TRouteManifest;
30
+ headTags: DefinedHeadTags<TRouteManifest, THeadTagSchema, TDefinitions>;
31
+ html: HtmlOptions;
32
+ headBasePath?: string;
33
+ routeBasePath?: string;
34
+ }
35
+ export interface HandleHeadTagRequestOptions<TRouteManifest extends AnyRoute, THeadTagSchema extends HeadTagSchemaShape, TDefinitions extends Partial<Record<keyof THeadTagSchema, HeadTagDefinition<any>>>> {
36
+ headTags: DefinedHeadTags<TRouteManifest, THeadTagSchema, TDefinitions>;
37
+ headBasePath?: string;
38
+ }
39
+ export interface HandleRequestResult {
40
+ matched: boolean;
41
+ response: Response;
42
+ }
43
+ export declare function handleHeadTagRequest<TRouteManifest extends AnyRoute, THeadTagSchema extends HeadTagSchemaShape, TDefinitions extends Partial<Record<keyof THeadTagSchema, HeadTagDefinition<any>>>>(request: Request, options: HandleHeadTagRequestOptions<TRouteManifest, THeadTagSchema, TDefinitions>): Promise<HandleRequestResult>;
44
+ export declare function handleRequest<TRouteManifest extends AnyRoute, THeadTagSchema extends HeadTagSchemaShape, TDefinitions extends Partial<Record<keyof THeadTagSchema, HeadTagDefinition<any>>>>(request: Request, options: HandleRequestOptions<TRouteManifest, THeadTagSchema, TDefinitions>): Promise<HandleRequestResult>;
package/package.json CHANGED
@@ -1,10 +1,46 @@
1
1
  {
2
2
  "name": "@richie-router/server",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @richie-router/server",
3
+ "version": "0.1.2",
4
+ "description": "Server helpers for Richie Router head tags and document handling",
5
+ "sideEffects": false,
6
+ "exports": {
7
+ "./package.json": "./package.json",
8
+ ".": {
9
+ "types": "./dist/types/index.d.ts",
10
+ "import": "./dist/esm/index.mjs",
11
+ "require": "./dist/cjs/index.cjs",
12
+ "default": "./dist/esm/index.mjs"
13
+ }
14
+ },
15
+ "dependencies": {
16
+ "@richie-router/core": "^0.1.1"
17
+ },
18
+ "author": "Richie <oss@ricsam.dev>",
19
+ "homepage": "https://docs.ricsam.dev/richie-router",
20
+ "bugs": {
21
+ "url": "https://github.com/ricsam/richie-router/issues"
22
+ },
5
23
  "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
10
- }
24
+ "router",
25
+ "react",
26
+ "typescript",
27
+ "bun",
28
+ "file-based-routing",
29
+ "type-safe"
30
+ ],
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/ricsam/richie-router.git",
34
+ "directory": "packages/server"
35
+ },
36
+ "main": "./dist/cjs/index.cjs",
37
+ "module": "./dist/esm/index.mjs",
38
+ "types": "./dist/types/index.d.ts",
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "provenance": true
45
+ }
46
+ }
package/README.md DELETED
@@ -1,45 +0,0 @@
1
- # @richie-router/server
2
-
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
4
-
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
6
-
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
8
-
9
- ## Purpose
10
-
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@richie-router/server`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
15
-
16
- ## What is OIDC Trusted Publishing?
17
-
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
19
-
20
- ## Setup Instructions
21
-
22
- To properly configure OIDC trusted publishing for this package:
23
-
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**