Skip to content

Commit ea503d7

Browse files
underootgithub-actions[bot]
authored andcommitted
Always send SDK param for style requests
GitOrigin-RevId: 5b1fe3cad1164e743514f9b557221996a2573e46
1 parent 4cac6f8 commit ea503d7

6 files changed

Lines changed: 6 additions & 10 deletions

File tree

build/rollup_plugins.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,22 @@ import minifyStyleSpec from './rollup_plugin_minify_style_spec.js';
1515
* builds (umd and esm mapboxgl bundles, style-spec package bundle)
1616
*
1717
* @param {Object} options
18-
* @param {string | 'dev' | 'production'} [options.mode] - build mode
1918
* @param {'umd' | 'csp' | 'esm'} [options.format] - bundle format, reported as `bundleFormat` in telemetry
2019
* @param {boolean} [options.minified] - whether to minify the output
2120
* @param {boolean} [options.production] - whether this is a production build
2221
* @param {boolean} [options.test] - whether this is a test build
2322
* @param {boolean} [options.keepClassNames] - whether to keep class names during minification
2423
* @returns {import('rollup').InputPluginOption[]}
2524
*/
26-
export const plugins = ({mode, format, minified, production, test, keepClassNames}) => [
25+
export const plugins = ({format, minified, production, test, keepClassNames}) => [
2726
minifyStyleSpec(),
2827
esbuild({
2928
target: browserslistToEsbuild(),
3029
minify: false,
3130
sourceMap: true,
3231
tsconfig: './tsconfig.browser.json',
3332
define: {
34-
'import.meta.env': JSON.stringify({mode, format}),
33+
'import.meta.env': JSON.stringify({format}),
3534
}
3635
}),
3736
json({

rollup.config.csp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const config = (input: InputOption, file: string, format: ModuleFormat): RollupO
1717
banner
1818
},
1919
treeshake: {preset: 'recommended', moduleSideEffects: (id) => !id.endsWith('devtools.ts')},
20-
plugins: plugins({minified: true, production: true, keepClassNames: true, test: false, mode: 'production', format: 'csp'})
20+
plugins: plugins({minified: true, production: true, keepClassNames: true, test: false, format: 'csp'})
2121
});
2222

2323
export default [

rollup.config.esm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function esmConfig(dir: string, workerSuffix: string, emitVisualizer = false): R
5959
preserveEntrySignatures: 'strict',
6060
plugins: [
6161
esmSubstitutions(workerSuffix),
62-
...plugins({production, minified, test: false, keepClassNames: false, mode: BUILD, format: 'esm'}),
62+
...plugins({production, minified, test: false, keepClassNames: false, format: 'esm'}),
6363
emitVisualizer && visualizer({
6464
filename: `${dir}treemap.html`,
6565
template: 'treemap',

rollup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default ({watch}: {watch: boolean}): RollupOptions[] => {
6464
},
6565
onwarn: production ? onwarn : undefined,
6666
treeshake: production ? {preset: 'recommended', moduleSideEffects: (id) => !id.endsWith('devtools.ts')} : false,
67-
plugins: [preserveDynamicImport(), ...plugins({minified, production, test: false, keepClassNames: false, mode: BUILD, format: 'umd'})]
67+
plugins: [preserveDynamicImport(), ...plugins({minified, production, test: false, keepClassNames: false, format: 'umd'})]
6868
}, {
6969
// Next, bundle together the three "chunks" produced in the previous pass
7070
// into a single, final bundle. See rollup/bundle_prelude.js and

src/types/import-meta.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
interface ImportMeta {
22
env: {
3-
mode?: 'dev' | 'production';
43
format?: 'umd' | 'csp' | 'esm';
54
[key: string]: unknown;
65
};

src/util/mapbox.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ export class RequestManager {
8080
normalizeStyleURL(url: string, accessToken?: string): string {
8181
if (!isMapboxURL(url)) return url;
8282
const urlObject = parseUrl(url);
83-
if (import.meta.env.mode !== 'dev') {
84-
urlObject.params.push(`sdk=js-${sdkVersion}`);
85-
}
83+
urlObject.params.push(`sdk=js-${sdkVersion}`);
8684
urlObject.path = `/styles/v1${urlObject.path}`;
8785
return this._makeAPIURL(urlObject, this._customAccessToken || accessToken);
8886
}

0 commit comments

Comments
 (0)