remove not working isLight function
This commit is contained in:
parent
a6123d1b6f
commit
30ac843a5f
3 changed files with 10 additions and 18 deletions
|
@ -14,14 +14,20 @@ import {
|
||||||
getTileUrls,
|
getTileUrls,
|
||||||
isValidHttpUrl,
|
isValidHttpUrl,
|
||||||
fetchTileData,
|
fetchTileData,
|
||||||
isLight,
|
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { getPMtilesInfo, openPMtiles } from './pmtiles_adapter.js';
|
import { getPMtilesInfo, openPMtiles } from './pmtiles_adapter.js';
|
||||||
import { gunzipP, gzipP } from './promises.js';
|
import { gunzipP, gzipP } from './promises.js';
|
||||||
import { openMbTilesWrapper } from './mbtiles_wrapper.js';
|
import { openMbTilesWrapper } from './mbtiles_wrapper.js';
|
||||||
|
|
||||||
|
import fs from 'node:fs';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
const packageJson = JSON.parse(
|
||||||
|
fs.readFileSync(path.dirname(fileURLToPath(import.meta.url)) + '/../package.json', 'utf8'),
|
||||||
|
);
|
||||||
|
|
||||||
|
const isLight = (packageJson.name.slice(-6) === '-light');
|
||||||
const serve_rendered = (
|
const serve_rendered = (
|
||||||
await import(`${!isLight() ? `./serve_rendered.js` : `./serve_light.js`}`)
|
await import(`${!isLight ? `./serve_rendered.js` : `./serve_light.js`}`)
|
||||||
).serve_rendered;
|
).serve_rendered;
|
||||||
|
|
||||||
export const serve_data = {
|
export const serve_data = {
|
||||||
|
|
|
@ -21,7 +21,6 @@ import {
|
||||||
getTileUrls,
|
getTileUrls,
|
||||||
getPublicUrl,
|
getPublicUrl,
|
||||||
isValidHttpUrl,
|
isValidHttpUrl,
|
||||||
isLight,
|
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
|
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
@ -29,9 +28,10 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
const packageJson = JSON.parse(
|
const packageJson = JSON.parse(
|
||||||
fs.readFileSync(__dirname + '/../package.json', 'utf8'),
|
fs.readFileSync(__dirname + '/../package.json', 'utf8'),
|
||||||
);
|
);
|
||||||
|
const isLight = (packageJson.name.slice(-6) === '-light');
|
||||||
|
|
||||||
const serve_rendered = (
|
const serve_rendered = (
|
||||||
await import(`${!isLight() ? `./serve_rendered.js` : `./serve_light.js`}`)
|
await import(`${!isLight ? `./serve_rendered.js` : `./serve_light.js`}`)
|
||||||
).serve_rendered;
|
).serve_rendered;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
14
src/utils.js
14
src/utils.js
|
@ -12,20 +12,6 @@ export const allowedSpriteFormats = allowedOptions(['png', 'json']);
|
||||||
|
|
||||||
export const allowedTileSizes = allowedOptions(['256', '512']);
|
export const allowedTileSizes = allowedOptions(['256', '512']);
|
||||||
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export function isLight() {
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = path.dirname(__filename);
|
|
||||||
const packageJson = JSON.parse(
|
|
||||||
fs.readFileSync(__dirname + '/../package.json', 'utf8'),
|
|
||||||
);
|
|
||||||
return packageJson.name.slice(-6) === '-light';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restrict user input to an allowed set of options.
|
* Restrict user input to an allowed set of options.
|
||||||
* @param {string[]} opts - An array of allowed option strings.
|
* @param {string[]} opts - An array of allowed option strings.
|
||||||
|
|
Loading…
Reference in a new issue