diff --git a/plugins/babel-plugin-canyon/package.json b/plugins/babel-plugin-canyon/package.json index 0c8f4787..96fa7ed0 100644 --- a/plugins/babel-plugin-canyon/package.json +++ b/plugins/babel-plugin-canyon/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-canyon", - "version": "1.8.78-beta.35", + "version": "1.8.78-beta.36", "description": "", "scripts": { "release": "babel src --extensions \".ts\" --out-dir lib", diff --git a/plugins/babel-plugin-canyon/src/index.ts b/plugins/babel-plugin-canyon/src/index.ts index e4f6b9ef..0ed30873 100644 --- a/plugins/babel-plugin-canyon/src/index.ts +++ b/plugins/babel-plugin-canyon/src/index.ts @@ -33,6 +33,7 @@ export default declare((api, config) => { projectID: serviceParams.slug, sha: serviceParams.commit, instrumentCwd: process.cwd(), + dsn: process.env['DSN']||'-' }) } }, diff --git a/plugins/babel-plugin-canyon/src/visitor-program-exit.ts b/plugins/babel-plugin-canyon/src/visitor-program-exit.ts index e5fb8264..2467fe4a 100644 --- a/plugins/babel-plugin-canyon/src/visitor-program-exit.ts +++ b/plugins/babel-plugin-canyon/src/visitor-program-exit.ts @@ -56,7 +56,12 @@ export const visitorProgramExit = (api,path,serviceParams) => { t.identifier("instrumentCwd"), // 键名 t.stringLiteral(serviceParams.instrumentCwd) // 键值 ); - properties.push(instrumentCwdField); // 添加新字段 + // 增加 dsn 字段 + const dsnField = t.objectProperty( + t.identifier("dsn"), // 键名 + t.stringLiteral(serviceParams.dsn) // 键值 + ); + properties.push(dsnField); // 添加新字段 } } }})