module.exports = (config, { dev }) => { const siteConfig = struct.interface( { title: 'string?', description: 'string?' }, {} ) // Type of Saber plugins const plugins = struct.union( [ ['string'], [ { resolve: 'string', options: 'object?' } ] ], [] ) const markdown = struct( { slugify: 'string?', options: 'object?', headings: 'object?', highlighter: 'string?', // Same as the type of Saber plugins plugins }, { plugins: [] } ) const themeConfig = struct.interface({}, {}) const permalinks = struct.union(['object', 'function'], {}) const server = struct( { host: 'string?', port: 'number?' }, { host: '0.0.0.0', port: 3000 } ) const build = struct( { publicUrl: 'string?', extractCSS: 'boolean?', loaderOptions: 'object?', cssSourceMap: 'boolean?', lazy: 'boolean?', outDir: 'string?' }, { publicUrl: '/', extractCSS: false, loaderOptions: {}, cssSourceMap: false, lazy: false, outDir: 'public' } ) const locales = struct('object?') const schema = struct({ build, siteConfig, themeConfig, locales, theme: 'string?', plugins, markdown, permalinks, server }) const [err, result] = schema.validate(config) if (err) { throw err } if (dev) { // Always use / in dev mode result.build.publicUrl = '/' } else { // Ensure that build.publicUrl ends with slash result.build.publicUrl = result.build.publicUrl.replace(/\/?$/, '/') } return result }
const Measurement = S.struct({ time: 'number', summary: 'string', icon: 'string', precipIntensity: 'number', precipIntensityError: 'number?', precipProbability: 'number', precipAccumulation: 'number?', precipIntensityMax: 'number?', precipIntensityMaxTime: 'number?', precipType: 'string?', temperature: 'number?', temperatureMin: 'number?', temperatureMinTime: 'number?', temperatureMax: 'number?', temperatureMaxTime: 'number?', temperatureLow: 'number?', temperatureLowTime: 'number?', temperatureHigh: 'number?', temperatureHighTime: 'number?', apparentTemperature: 'number?', apparentTemperatureMin: 'number?', apparentTemperatureMinTime: 'number?', apparentTemperatureMax: 'number?', apparentTemperatureMaxTime: 'number?', apparentTemperatureHigh: 'number?', apparentTemperatureHighTime: 'number?', apparentTemperatureLow: 'number?', apparentTemperatureLowTime: 'number?', dewPoint: 'number', humidity: 'number', pressure: 'number', windSpeed: 'number', windGust: 'number?', windGustTime: 'number?', windBearing: 'number', cloudCover: 'number?', uvIndex: 'number?', uvIndexTime: 'number?', visibility: 'number?', ozone: 'number', sunriseTime: 'number?', sunsetTime: 'number?', moonPhase: 'number?', nearestStormDistance: 'number?', nearestStormBearing: 'number?' })
import getTrackerCodeMeta from "../tools/getTrackerCodeMeta"; import storageGet from "../tools/storageGet"; import storageSet from "../tools/storageSet"; import getHash from "../tools/getHash"; import setCodeMeta from "../tools/setCodeMeta"; const logger = getLogger('TrackerStoreStore'); const Files = struct([struct.partial({ name: 'string', // path: 'string', // sha: 'string', size: 'number', // url: 'string', html_url: 'string', // git_url: 'string', download_url: 'string', type: 'string', // _links: struct.partial({ // self: 'string', // git: 'string', // html: 'string', // }), })]); /** * @typedef {{}} TrackerStoreResultStore * @property {string} [state] * @property {string|undefined} id * @property {string} name * @property {number} size * @property {string} fileType