@interfere/build 0.3.3 → 0.4.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/README.md +8 -0
- package/dist/service-name.cjs +1 -0
- package/dist/service-name.d.cts +9 -0
- package/dist/service-name.d.mts +9 -0
- package/dist/service-name.mjs +1 -0
- package/package.json +13 -2
package/README.md
CHANGED
|
@@ -23,3 +23,11 @@ When calling `uploadSourceMapChunks` directly, construct the API client with
|
|
|
23
23
|
`fetch: sourceMapUploadFetch` from `@interfere/build/source-map-upload-fetch` and
|
|
24
24
|
pass `compression: "gzip"` to the uploader. Direct callers retain identity uploads
|
|
25
25
|
unless they opt in; Next.js and Vite configure both automatically.
|
|
26
|
+
|
|
27
|
+
`resolveBuildServiceName` from `@interfere/build/service-name` supplies the same
|
|
28
|
+
service identity policy to Next.js and Vite: an explicit plugin option, then
|
|
29
|
+
`OTEL_SERVICE_NAME`, then the app's unscoped `package.json` name. Vite also accepts
|
|
30
|
+
its legacy `VITE_INTERFERE_SERVICE_NAME` variable before the package fallback.
|
|
31
|
+
Blank values are skipped; a missing or invalid package name leaves the default
|
|
32
|
+
unset. Each framework injects this value into its browser and server entry points,
|
|
33
|
+
where explicit runtime service names still take precedence.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let _interfere_types_sdk_runtime=require("@interfere/types/sdk/runtime"),node_fs=require("node:fs"),node_path=require("node:path");const SCOPE_PREFIX=/^@[^/]+\//u;function nonEmpty(value){return value?.trim()||void 0}function packageServiceName(root){let manifest;try{manifest=JSON.parse((0,node_fs.readFileSync)((0,node_path.join)(root,`package.json`),`utf8`))}catch{return}if(typeof manifest==`object`&&manifest&&`name`in manifest)return typeof manifest.name==`string`?nonEmpty(manifest.name.trim().replace(SCOPE_PREFIX,``)):void 0}function resolveBuildServiceName({root,option,env=(0,_interfere_types_sdk_runtime.readProcessEnv)()??{},legacyEnvName}){return nonEmpty(option)??nonEmpty(env.OTEL_SERVICE_NAME)??nonEmpty(legacyEnvName?env[legacyEnvName]:void 0)??packageServiceName(root)}exports.resolveBuildServiceName=resolveBuildServiceName;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/service-name.d.ts
|
|
2
|
+
/** Resolve a build's service name from an option, OTEL_SERVICE_NAME, a legacy environment alias, or its unscoped app package name. */
|
|
3
|
+
export declare function resolveBuildServiceName({ root, option, env, legacyEnvName }: {
|
|
4
|
+
root: string;
|
|
5
|
+
option?: string | undefined;
|
|
6
|
+
env?: Readonly<Record<string, string | undefined>>;
|
|
7
|
+
legacyEnvName?: string;
|
|
8
|
+
}): string | undefined;
|
|
9
|
+
//#endregion
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/service-name.d.ts
|
|
2
|
+
/** Resolve a build's service name from an option, OTEL_SERVICE_NAME, a legacy environment alias, or its unscoped app package name. */
|
|
3
|
+
export declare function resolveBuildServiceName({ root, option, env, legacyEnvName }: {
|
|
4
|
+
root: string;
|
|
5
|
+
option?: string | undefined;
|
|
6
|
+
env?: Readonly<Record<string, string | undefined>>;
|
|
7
|
+
legacyEnvName?: string;
|
|
8
|
+
}): string | undefined;
|
|
9
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readProcessEnv}from"@interfere/types/sdk/runtime";import{readFileSync}from"node:fs";import{join}from"node:path";const SCOPE_PREFIX=/^@[^/]+\//u;function nonEmpty(value){return value?.trim()||void 0}function packageServiceName(root){let manifest;try{manifest=JSON.parse(readFileSync(join(root,`package.json`),`utf8`))}catch{return}if(typeof manifest==`object`&&manifest&&`name`in manifest)return typeof manifest.name==`string`?nonEmpty(manifest.name.trim().replace(SCOPE_PREFIX,``)):void 0}function resolveBuildServiceName({root,option,env=readProcessEnv()??{},legacyEnvName}){return nonEmpty(option)??nonEmpty(env.OTEL_SERVICE_NAME)??nonEmpty(legacyEnvName?env[legacyEnvName]:void 0)??packageServiceName(root)}export{resolveBuildServiceName};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interfere/build",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Release preparation for Interfere build integrations.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build",
|
|
@@ -25,6 +25,17 @@
|
|
|
25
25
|
],
|
|
26
26
|
"type": "module",
|
|
27
27
|
"exports": {
|
|
28
|
+
"./service-name": {
|
|
29
|
+
"monorepo": "./src/service-name.ts",
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/service-name.d.mts",
|
|
32
|
+
"default": "./dist/service-name.mjs"
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"types": "./dist/service-name.d.cts",
|
|
36
|
+
"default": "./dist/service-name.cjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
28
39
|
"./config": {
|
|
29
40
|
"monorepo": "./src/config.ts",
|
|
30
41
|
"import": {
|
|
@@ -92,7 +103,7 @@
|
|
|
92
103
|
},
|
|
93
104
|
"dependencies": {
|
|
94
105
|
"@interfere/javascript": "^0.3.0",
|
|
95
|
-
"@interfere/types": "^10.
|
|
106
|
+
"@interfere/types": "^10.5.0"
|
|
96
107
|
},
|
|
97
108
|
"devDependencies": {
|
|
98
109
|
"@interfere/typescript-config": "^9.0.2",
|