@bugsnag/source-maps
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -0,3 +1,7 @@ | ||
# 1.0.1 (2020-12-14) | ||
- Automatically set an appropriate path on the endpoint URL unless one is explicitly provided [#48](https://github.com/bugsnag/bugsnag-source-maps/pull/48) | ||
# 1.0.0 (2020-12-10) | ||
Initial release. |
@@ -27,6 +27,15 @@ "use strict"; | ||
const DetectAppVersion_1 = __importDefault(require("./lib/DetectAppVersion")); | ||
const UPLOAD_ENDPOINT = 'https://upload.bugsnag.com/source-map'; | ||
function uploadOne({ apiKey, bundleUrl, bundle, sourceMap, appVersion, codeBundleId, overwrite = false, projectRoot = process.cwd(), endpoint = UPLOAD_ENDPOINT, detectAppVersion = false, requestOpts = {}, logger = Logger_1.noopLogger }) { | ||
const EndpointUrl_1 = require("./lib/EndpointUrl"); | ||
const UPLOAD_PATH = '/sourcemap'; | ||
function uploadOne({ apiKey, bundleUrl, bundle, sourceMap, appVersion, codeBundleId, overwrite = false, projectRoot = process.cwd(), endpoint = EndpointUrl_1.DEFAULT_UPLOAD_ORIGIN, detectAppVersion = false, requestOpts = {}, logger = Logger_1.noopLogger }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
logger.info(`Preparing upload of browser source map for "${bundleUrl}"`); | ||
let url; | ||
try { | ||
url = EndpointUrl_1.buildEndpointUrl(endpoint, UPLOAD_PATH); | ||
} | ||
catch (e) { | ||
logger.error(e); | ||
throw e; | ||
} | ||
const [sourceMapContent, fullSourceMapPath] = yield ReadSourceMap_1.default(sourceMap, projectRoot, logger); | ||
@@ -49,6 +58,6 @@ let bundleContent; | ||
} | ||
logger.debug(`Initiating upload to "${endpoint}"`); | ||
logger.debug(`Initiating upload to "${url}"`); | ||
const start = new Date().getTime(); | ||
try { | ||
yield Request_1.default(endpoint, { | ||
yield Request_1.default(url, { | ||
type: 0 /* Browser */, | ||
@@ -64,3 +73,3 @@ apiKey, | ||
const uploadedFiles = (bundleContent && fullBundlePath) ? `${sourceMap} and ${bundle}` : sourceMap; | ||
logger.success(`Success, uploaded ${uploadedFiles} to ${endpoint} in ${(new Date()).getTime() - start}ms`); | ||
logger.success(`Success, uploaded ${uploadedFiles} to ${url} in ${(new Date()).getTime() - start}ms`); | ||
} | ||
@@ -79,5 +88,13 @@ catch (e) { | ||
exports.uploadOne = uploadOne; | ||
function uploadMultiple({ apiKey, baseUrl, directory, appVersion, overwrite = false, detectAppVersion = false, projectRoot = process.cwd(), endpoint = UPLOAD_ENDPOINT, requestOpts = {}, logger = Logger_1.noopLogger }) { | ||
function uploadMultiple({ apiKey, baseUrl, directory, appVersion, overwrite = false, detectAppVersion = false, projectRoot = process.cwd(), endpoint = EndpointUrl_1.DEFAULT_UPLOAD_ORIGIN, requestOpts = {}, logger = Logger_1.noopLogger }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
logger.info(`Preparing upload of browser source maps for "${baseUrl}"`); | ||
let url; | ||
try { | ||
url = EndpointUrl_1.buildEndpointUrl(endpoint, UPLOAD_PATH); | ||
} | ||
catch (e) { | ||
logger.error(e); | ||
throw e; | ||
} | ||
logger.debug(`Searching for source maps "${directory}"`); | ||
@@ -122,6 +139,6 @@ const absoluteSearchPath = path_1.default.resolve(projectRoot, directory); | ||
const transformedSourceMap = yield ApplyTransformations_1.default(fullSourceMapPath, sourceMapJson, projectRoot, logger); | ||
logger.debug(`Initiating upload to "${endpoint}"`); | ||
logger.debug(`Initiating upload to "${url}"`); | ||
const start = new Date().getTime(); | ||
try { | ||
yield Request_1.default(endpoint, { | ||
yield Request_1.default(url, { | ||
type: 0 /* Browser */, | ||
@@ -136,3 +153,3 @@ apiKey, | ||
const uploadedFiles = (bundleContent && fullBundlePath) ? `${sourceMap} and ${bundlePath}` : sourceMap; | ||
logger.success(`Success, uploaded ${uploadedFiles} to ${endpoint} in ${(new Date()).getTime() - start}ms`); | ||
logger.success(`Success, uploaded ${uploadedFiles} to ${url} in ${(new Date()).getTime() - start}ms`); | ||
} | ||
@@ -139,0 +156,0 @@ catch (e) { |
@@ -27,6 +27,15 @@ "use strict"; | ||
const DetectAppVersion_1 = __importDefault(require("./lib/DetectAppVersion")); | ||
const UPLOAD_ENDPOINT = 'https://upload.bugsnag.com/source-map'; | ||
function uploadOne({ apiKey, bundle, sourceMap, appVersion, overwrite = false, projectRoot = process.cwd(), endpoint = UPLOAD_ENDPOINT, detectAppVersion = false, requestOpts = {}, logger = Logger_1.noopLogger }) { | ||
const EndpointUrl_1 = require("./lib/EndpointUrl"); | ||
const UPLOAD_PATH = '/sourcemap'; | ||
function uploadOne({ apiKey, bundle, sourceMap, appVersion, overwrite = false, projectRoot = process.cwd(), endpoint = EndpointUrl_1.DEFAULT_UPLOAD_ORIGIN, detectAppVersion = false, requestOpts = {}, logger = Logger_1.noopLogger }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
logger.info(`Preparing upload of node source map for "${bundle}"`); | ||
let url; | ||
try { | ||
url = EndpointUrl_1.buildEndpointUrl(endpoint, UPLOAD_PATH); | ||
} | ||
catch (e) { | ||
logger.error(e); | ||
throw e; | ||
} | ||
const [sourceMapContent, fullSourceMapPath] = yield ReadSourceMap_1.default(sourceMap, projectRoot, logger); | ||
@@ -45,6 +54,6 @@ const [bundleContent, fullBundlePath] = yield ReadBundleContent_1.default(bundle, projectRoot, sourceMap, logger); | ||
} | ||
logger.debug(`Initiating upload to "${endpoint}"`); | ||
logger.debug(`Initiating upload to "${url}"`); | ||
const start = new Date().getTime(); | ||
try { | ||
yield Request_1.default(endpoint, { | ||
yield Request_1.default(url, { | ||
type: 2 /* Node */, | ||
@@ -58,3 +67,3 @@ apiKey, | ||
}, requestOpts); | ||
logger.success(`Success, uploaded ${sourceMap} and ${bundle} to ${endpoint} in ${(new Date()).getTime() - start}ms`); | ||
logger.success(`Success, uploaded ${sourceMap} and ${bundle} to ${url} in ${(new Date()).getTime() - start}ms`); | ||
} | ||
@@ -73,5 +82,13 @@ catch (e) { | ||
exports.uploadOne = uploadOne; | ||
function uploadMultiple({ apiKey, directory, appVersion, overwrite = false, projectRoot = process.cwd(), endpoint = UPLOAD_ENDPOINT, detectAppVersion = false, requestOpts = {}, logger = Logger_1.noopLogger }) { | ||
function uploadMultiple({ apiKey, directory, appVersion, overwrite = false, projectRoot = process.cwd(), endpoint = EndpointUrl_1.DEFAULT_UPLOAD_ORIGIN, detectAppVersion = false, requestOpts = {}, logger = Logger_1.noopLogger }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
logger.info(`Preparing upload of node source maps for "${directory}"`); | ||
let url; | ||
try { | ||
url = EndpointUrl_1.buildEndpointUrl(endpoint, UPLOAD_PATH); | ||
} | ||
catch (e) { | ||
logger.error(e); | ||
throw e; | ||
} | ||
logger.debug(`Searching for source maps "${directory}"`); | ||
@@ -116,6 +133,6 @@ const absoluteSearchPath = path_1.default.resolve(projectRoot, directory); | ||
const transformedSourceMap = yield ApplyTransformations_1.default(fullSourceMapPath, sourceMapJson, projectRoot, logger); | ||
logger.debug(`Initiating upload to "${endpoint}"`); | ||
logger.debug(`Initiating upload to "${url}"`); | ||
const start = new Date().getTime(); | ||
try { | ||
yield Request_1.default(endpoint, { | ||
yield Request_1.default(url, { | ||
type: 2 /* Node */, | ||
@@ -130,3 +147,3 @@ apiKey, | ||
const uploadedFiles = (bundleContent && fullBundlePath) ? `${sourceMap} and ${bundlePath}` : sourceMap; | ||
logger.success(`Success, uploaded ${uploadedFiles} to ${endpoint} in ${(new Date()).getTime() - start}ms`); | ||
logger.success(`Success, uploaded ${uploadedFiles} to ${url} in ${(new Date()).getTime() - start}ms`); | ||
} | ||
@@ -133,0 +150,0 @@ catch (e) { |
@@ -46,5 +46,15 @@ "use strict"; | ||
const NetworkError_1 = require("../NetworkError"); | ||
function uploadOne({ apiKey, sourceMap, bundle, platform, dev = false, appVersion, codeBundleId, appVersionCode, appBundleVersion, overwrite = false, projectRoot = process.cwd(), endpoint = 'https://upload.bugsnag.com/react-native-source-map', requestOpts = {}, logger = Logger_1.noopLogger }) { | ||
const EndpointUrl_1 = require("./lib/EndpointUrl"); | ||
const UPLOAD_PATH = '/react-native-source-map'; | ||
function uploadOne({ apiKey, sourceMap, bundle, platform, dev = false, appVersion, codeBundleId, appVersionCode, appBundleVersion, overwrite = false, projectRoot = process.cwd(), endpoint = EndpointUrl_1.DEFAULT_UPLOAD_ORIGIN, requestOpts = {}, logger = Logger_1.noopLogger }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
logger.info(`Preparing upload of React Native source map (${dev ? 'dev' : 'release'} / ${platform})`); | ||
let url; | ||
try { | ||
url = EndpointUrl_1.buildEndpointUrl(endpoint, UPLOAD_PATH); | ||
} | ||
catch (e) { | ||
logger.error(e); | ||
throw e; | ||
} | ||
const [sourceMapContent, fullSourceMapPath] = yield ReadSourceMap_1.default(sourceMap, projectRoot, logger); | ||
@@ -55,8 +65,8 @@ const [bundleContent, fullBundlePath] = yield ReadBundleContent_1.default(bundle, projectRoot, sourceMap, logger); | ||
const marshalledVersions = marshallVersionOptions({ appVersion, codeBundleId, appBundleVersion, appVersionCode }, platform); | ||
logger.debug(`Initiating upload to "${endpoint}"`); | ||
logger.debug(`Initiating upload to "${url}"`); | ||
const start = new Date().getTime(); | ||
try { | ||
yield Request_1.default(endpoint, Object.assign(Object.assign({ type: 1 /* ReactNative */, apiKey, sourceMap: new File_1.default(fullSourceMapPath, JSON.stringify(transformedSourceMap)), bundle: new File_1.default(fullBundlePath, bundleContent), platform, | ||
yield Request_1.default(url, Object.assign(Object.assign({ type: 1 /* ReactNative */, apiKey, sourceMap: new File_1.default(fullSourceMapPath, JSON.stringify(transformedSourceMap)), bundle: new File_1.default(fullBundlePath, bundleContent), platform, | ||
dev }, marshalledVersions), { overwrite }), requestOpts); | ||
logger.success(`Success, uploaded ${sourceMap} and ${bundle} to ${endpoint} in ${(new Date()).getTime() - start}ms`); | ||
logger.success(`Success, uploaded ${sourceMap} and ${bundle} to ${url} in ${(new Date()).getTime() - start}ms`); | ||
} | ||
@@ -75,5 +85,13 @@ catch (e) { | ||
exports.uploadOne = uploadOne; | ||
function fetchAndUploadOne({ apiKey, platform, dev = false, appVersion, codeBundleId, appVersionCode, appBundleVersion, overwrite = false, projectRoot = process.cwd(), endpoint = 'https://upload.bugsnag.com/react-native-source-map', requestOpts = {}, bundlerUrl = 'http://localhost:8081', bundlerEntryPoint = 'index.js', logger = Logger_1.noopLogger }) { | ||
function fetchAndUploadOne({ apiKey, platform, dev = false, appVersion, codeBundleId, appVersionCode, appBundleVersion, overwrite = false, projectRoot = process.cwd(), endpoint = EndpointUrl_1.DEFAULT_UPLOAD_ORIGIN, requestOpts = {}, bundlerUrl = 'http://localhost:8081', bundlerEntryPoint = 'index.js', logger = Logger_1.noopLogger }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
logger.info(`Fetching React Native source map (${dev ? 'dev' : 'release'} / ${platform})`); | ||
let url; | ||
try { | ||
url = EndpointUrl_1.buildEndpointUrl(endpoint, UPLOAD_PATH); | ||
} | ||
catch (e) { | ||
logger.error(e); | ||
throw e; | ||
} | ||
const queryString = querystring_1.default.stringify({ platform, dev }); | ||
@@ -105,8 +123,8 @@ const entryPoint = bundlerEntryPoint.replace(/\.(js|bundle)$/, ''); | ||
const marshalledVersions = marshallVersionOptions({ appVersion, codeBundleId, appBundleVersion, appVersionCode }, platform); | ||
logger.debug(`Initiating upload to "${endpoint}"`); | ||
logger.debug(`Initiating upload to "${url}"`); | ||
const start = new Date().getTime(); | ||
try { | ||
yield Request_1.default(endpoint, Object.assign(Object.assign({ type: 1 /* ReactNative */, apiKey, sourceMap: new File_1.default(sourceMapUrl, JSON.stringify(transformedSourceMap)), bundle: new File_1.default(bundleUrl, bundle), platform, | ||
yield Request_1.default(url, Object.assign(Object.assign({ type: 1 /* ReactNative */, apiKey, sourceMap: new File_1.default(sourceMapUrl, JSON.stringify(transformedSourceMap)), bundle: new File_1.default(bundleUrl, bundle), platform, | ||
dev }, marshalledVersions), { overwrite }), requestOpts); | ||
logger.success(`Success, uploaded ${entryPoint}.js.map to ${endpoint} in ${(new Date()).getTime() - start}ms`); | ||
logger.success(`Success, uploaded ${entryPoint}.js.map to ${url} in ${(new Date()).getTime() - start}ms`); | ||
} | ||
@@ -113,0 +131,0 @@ catch (e) { |
{ | ||
"name": "@bugsnag/source-maps", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "CLI and JS library for uploading source maps to Bugsnag", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -49,14 +49,8 @@ # @bugsnag/source-maps | ||
If you are using Bugsnag On-premise, you should use the endpoint option to set the url of your [upload server](https://docs.bugsnag.com/on-premise/single-machine/service-ports/#bugsnag-upload-server). You must include the correct path, for example: | ||
If you are using Bugsnag On-premise, you should use the endpoint option to set the url of your [upload server](https://docs.bugsnag.com/on-premise/single-machine/service-ports/#bugsnag-upload-server), for example: | ||
```sh | ||
# browser/node uploads | ||
bugsnag-react-native upload-browser \ | ||
--endpoint https://bugsnag.my-company.com/source-map \ | ||
--endpoint https://bugsnag.my-company.com/ | ||
# ... other options | ||
# react native uploads | ||
bugsnag-react-native upload-react-native \ | ||
--endpoint https://bugsnag.my-company.com/react-native-source-map \ | ||
# ... other options | ||
``` | ||
@@ -63,0 +57,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
140532
77
2004
70