remove not working isLight function

This commit is contained in:
Miko 2025-01-17 22:15:06 +01:00
parent a6123d1b6f
commit 30ac843a5f
3 changed files with 10 additions and 18 deletions

View file

@ -14,14 +14,20 @@ import {
getTileUrls,
isValidHttpUrl,
fetchTileData,
isLight,
} from './utils.js';
import { getPMtilesInfo, openPMtiles } from './pmtiles_adapter.js';
import { gunzipP, gzipP } from './promises.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 = (
await import(`${!isLight() ? `./serve_rendered.js` : `./serve_light.js`}`)
await import(`${!isLight ? `./serve_rendered.js` : `./serve_light.js`}`)
).serve_rendered;
export const serve_data = {

View file

@ -21,7 +21,6 @@ import {
getTileUrls,
getPublicUrl,
isValidHttpUrl,
isLight,
} from './utils.js';
import { fileURLToPath } from 'url';
@ -29,9 +28,10 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
const packageJson = JSON.parse(
fs.readFileSync(__dirname + '/../package.json', 'utf8'),
);
const isLight = (packageJson.name.slice(-6) === '-light');
const serve_rendered = (
await import(`${!isLight() ? `./serve_rendered.js` : `./serve_light.js`}`)
await import(`${!isLight ? `./serve_rendered.js` : `./serve_light.js`}`)
).serve_rendered;
/**

View file

@ -12,20 +12,6 @@ export const allowedSpriteFormats = allowedOptions(['png', 'json']);
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.
* @param {string[]} opts - An array of allowed option strings.