@datadog/rspack-plugin 3.3.3-dev.1 → 3.3.3-dev.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.
@@ -1 +1 @@
1
- const n=["datadoghq.com","us3.datadoghq.com","us5.datadoghq.com","datadoghq.eu","ddog-gov.com","us2.ddog-gov.com","ap1.datadoghq.com","ap2.datadoghq.com","uk1.datadoghq.com","datad0g.com"];function e(n){return null!==n&&"object"==typeof n}let t=0;function o(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();t+=1;const n=Math.random().toString(36).slice(2);return`req-${Date.now()}-${t}-${n}`}function r(e){let t;try{t=new URL(e)}catch{return!1}const o=t.hostname.endsWith(".")?t.hostname.slice(0,-1):t.hostname;return"https:"===t.protocol&&""===t.port&&void 0!==(e=>{if("string"!=typeof e)return;const t=e.toLowerCase(),o=n.find((n=>n===t));if(o)return{site:o};const r=n.filter((n=>t.endsWith(`.${n}`)));if(!r.length)return;const a=r.reduce(((n,e)=>e.length>n.length?e:n)),i=t.slice(0,t.length-a.length-1);return i&&/^[a-z0-9-]+$/.test(i)?{site:a,subdomain:i}:void 0})(o)}let a,i,s=0,d=!1,c=!1;function u(n){var t;n.source===window.parent&&(e(t=n.data)&&"type"in t&&("app-builder:pong"===t.type||"app-builder:run-query:response"===t.type))&&(a=n.origin,window.removeEventListener("message",u),i?.end())}async function l(n){const e=window.location.ancestorOrigins;return e?e[0]:(n&&await function(){if(void 0!==i)return i.answered;window.addEventListener("message",u);let n=()=>{};const e=new Promise((e=>{n=e})),t=setTimeout(a,2e3);function r(){clearTimeout(t),i=void 0,n()}function a(){s+=1,r()}i={answered:e,end:r};const d={type:"app-builder:ping",requestId:o()};try{window.parent.postMessage(d,"*")}catch{a()}return e}(),a)}function g(n,e){console.warn(`[dd-apps] Sending "${n}" without its dev server bundle: ${e}`)}async function p(n){const t={functionName:n},o=JSON.stringify(t),r=new AbortController,a=setTimeout((()=>{const n=new Error("timed out after 60000ms");r.abort(n)}),6e4);try{const n=await fetch("/__dd/debugBundle",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:o,signal:r.signal});if(!n.ok){const t=await async function(n){const t=`HTTP ${n.status}`;try{const o=await n.json();return e(o)&&"error"in o&&"string"==typeof o.error?`${t}: ${o.error}`:t}catch{return t}}(n);return{failure:t}}const t=await n.json();return e(i=t)&&"code"in i&&"string"==typeof i.code&&i.code.length>0&&"allowedConnectionIds"in i&&Array.isArray(i.allowedConnectionIds)&&i.allowedConnectionIds.every((n=>"string"==typeof n))?{bundle:{code:t.code,allowedConnectionIds:t.allowedConnectionIds}}:{failure:"the dev server response is not a bundle"}}catch(n){return{failure:n instanceof Error?n.message:String(n)}}finally{clearTimeout(a)}var i}Reflect.set(globalThis,"DD_APPS_PREPARE_CALL",(async n=>{const e=!window.location.ancestorOrigins&&window.parent!==window&&void 0===a&&s<2,t=e?p(n):void 0,o=await l(e);if(void 0===o&&e&&function(n){d||(d=!0,g(n,"no answer came back from the parent page, so it can't be confirmed as a Datadog page"))}(n),"null"===o&&function(n){c||(c=!0,g(n,'the parent page has an opaque origin ("null"), so it can\'t be confirmed as a Datadog page'))}(n),void 0===o||!r(o))return{};const i=await(t??p(n));return"failure"in i?(g(n,i.failure),{targetOrigin:o}):{targetOrigin:o,bundle:i.bundle}}));
1
+ const e=["datadoghq.com","us3.datadoghq.com","us5.datadoghq.com","datadoghq.eu","ddog-gov.com","us2.ddog-gov.com","ap1.datadoghq.com","ap2.datadoghq.com","uk1.datadoghq.com","datad0g.com"],n=new Set(["api","app"]);function t(e){return null!==e&&"object"==typeof e}let o=0;function r(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();o+=1;const e=Math.random().toString(36).slice(2);return`req-${Date.now()}-${o}-${e}`}function a(t){let o;try{o=new URL(t)}catch{return!1}const r=o.hostname.endsWith(".")?o.hostname.slice(0,-1):o.hostname;return"https:"===o.protocol&&""===o.port&&void 0!==(t=>{if("string"!=typeof t)return;const o=(e=>(e.trim().replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[/?#]/)[0]??"").trim().toLowerCase())(t),r=e.find((e=>e===o));if(r)return{site:r};const a=e.filter((e=>o.endsWith(`.${e}`)));if(!a.length)return;const i=a.reduce(((e,n)=>n.length>e.length?n:e)),s=o.slice(0,o.length-i.length-1);return/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(s)?n.has(s)?{site:i}:{site:i,subdomain:s}:void 0})(r)}let i,s,c=0,d=!1,u=!1;function l(e){var n;e.source===window.parent&&(t(n=e.data)&&"type"in n&&("app-builder:pong"===n.type||"app-builder:run-query:response"===n.type))&&(i=e.origin,window.removeEventListener("message",l),s?.end())}async function p(e){const n=window.location.ancestorOrigins;return n?n[0]:(e&&await function(){if(void 0!==s)return s.answered;window.addEventListener("message",l);let e=()=>{};const n=new Promise((n=>{e=n})),t=setTimeout(a,2e3);function o(){clearTimeout(t),s=void 0,e()}function a(){c+=1,o()}s={answered:n,end:o};const i={type:"app-builder:ping",requestId:r()};try{window.parent.postMessage(i,"*")}catch{a()}return n}(),i)}function g(e,n){console.warn(`[dd-apps] Sending "${e}" without its dev server bundle: ${n}`)}async function f(e){const n={functionName:e},o=JSON.stringify(n),r=new AbortController,a=setTimeout((()=>{const e=new Error("timed out after 60000ms");r.abort(e)}),6e4);try{const e=await fetch("/__dd/debugBundle",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:o,signal:r.signal});if(!e.ok){const n=await async function(e){const n=`HTTP ${e.status}`;try{const o=await e.json();return t(o)&&"error"in o&&"string"==typeof o.error?`${n}: ${o.error}`:n}catch{return n}}(e);return{failure:n}}const n=await e.json();return t(i=n)&&"code"in i&&"string"==typeof i.code&&i.code.length>0&&"allowedConnectionIds"in i&&Array.isArray(i.allowedConnectionIds)&&i.allowedConnectionIds.every((e=>"string"==typeof e))?{bundle:{code:n.code,allowedConnectionIds:n.allowedConnectionIds}}:{failure:"the dev server response is not a bundle"}}catch(e){return{failure:e instanceof Error?e.message:String(e)}}finally{clearTimeout(a)}var i}Reflect.set(globalThis,"DD_APPS_PREPARE_CALL",(async e=>{const n=!window.location.ancestorOrigins&&window.parent!==window&&void 0===i&&c<2,t=n?f(e):void 0,o=await p(n);if(void 0===o&&n&&function(e){d||(d=!0,g(e,"no answer came back from the parent page, so it can't be confirmed as a Datadog page"))}(e),"null"===o&&function(e){u||(u=!0,g(e,'the parent page has an opaque origin ("null"), so it can\'t be confirmed as a Datadog page'))}(e),void 0===o||!a(o))return{};const r=await(t??f(e));return"failure"in r?(g(e,r.failure),{targetOrigin:o}):{targetOrigin:o,bundle:r.bundle}}));
@@ -73,7 +73,7 @@ type ServiceVersionSourcemapsOptions = SourcemapsUploadOptions & {
73
73
  debugId?: false;
74
74
  minifiedPathPrefix: MinifiedPathPrefix;
75
75
  releaseVersion?: string;
76
- service: string;
76
+ service?: string;
77
77
  };
78
78
  type SourcemapsOptions = DebugIdSourcemapsOptions | ServiceVersionSourcemapsOptions;
79
79
  type ErrorTrackingOptions = {
@@ -113,6 +113,8 @@ type LiveDebuggerOptions = {
113
113
  };
114
114
  type LiveDebuggerOptionsWithDefaults = {
115
115
  version: string | undefined;
116
+ service: string | undefined;
117
+ enableGit: boolean;
116
118
  debugId: boolean;
117
119
  include: (string | RegExp)[];
118
120
  exclude: (string | RegExp)[];
@@ -5136,7 +5138,7 @@ type DebugIdSourceCodeContextOptions = {
5136
5138
  };
5137
5139
  type ServiceVersionSourceCodeContextOptions = {
5138
5140
  debugId?: false;
5139
- service: string;
5141
+ service?: string;
5140
5142
  version?: string;
5141
5143
  };
5142
5144
  type SourceCodeContextOptions = DebugIdSourceCodeContextOptions | ServiceVersionSourceCodeContextOptions;
@@ -5250,6 +5252,7 @@ type Timer = {
5250
5252
  };
5251
5253
  type BuildMetadata = {
5252
5254
  name?: string;
5255
+ service?: string;
5253
5256
  version?: string;
5254
5257
  };
5255
5258
  type BuildReport = {
@@ -5342,10 +5345,14 @@ type GlobalContext = {
5342
5345
  env: GlobalData["env"];
5343
5346
  getLogger: GetLogger;
5344
5347
  git?: RepositoryData;
5348
+ gitPending: boolean;
5349
+ gitReady: Promise<void>;
5345
5350
  hook: TriggerHook<void>;
5346
5351
  inject: (item: ToInjectItem) => void;
5347
5352
  markArtifactsPending: () => void;
5348
5353
  markArtifactsReady: (error?: unknown) => void;
5354
+ markGitPending: () => void;
5355
+ markGitReady: () => void;
5349
5356
  pluginNames: string[];
5350
5357
  plugins: (PluginOptions | CustomPluginOptions)[];
5351
5358
  queue: (promise: Promise<any>) => void;