@ohos-ports/layer0-prefetch 4.20.0-beta.0 → 4.20.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@layer0/core/README.md +50 -0
- package/node_modules/@layer0/core/build.d.ts +5 -0
- package/node_modules/@layer0/core/build.js +17 -0
- package/node_modules/@layer0/core/cache/Cache.d.ts +56 -0
- package/node_modules/@layer0/core/cache/Cache.js +138 -0
- package/node_modules/@layer0/core/cache/CacheKey.d.ts +52 -0
- package/node_modules/@layer0/core/cache/CacheKey.js +95 -0
- package/node_modules/@layer0/core/config.d.ts +53 -0
- package/node_modules/@layer0/core/config.js +113 -0
- package/node_modules/@layer0/core/constants.d.ts +214 -0
- package/node_modules/@layer0/core/constants.js +216 -0
- package/node_modules/@layer0/core/context.d.ts +38 -0
- package/node_modules/@layer0/core/context.js +98 -0
- package/node_modules/@layer0/core/default-app/all/layer0.config.js +60 -0
- package/node_modules/@layer0/core/default-app/js/routes.js +27 -0
- package/node_modules/@layer0/core/default-app/ts/routes.ts +27 -0
- package/node_modules/@layer0/core/deploy/DeploymentBuilder.d.ts +177 -0
- package/node_modules/@layer0/core/deploy/DeploymentBuilder.js +543 -0
- package/node_modules/@layer0/core/deploy/bundle-esbuild.d.ts +11 -0
- package/node_modules/@layer0/core/deploy/bundle-esbuild.js +67 -0
- package/node_modules/@layer0/core/deploy/bundle-ncc.d.ts +8 -0
- package/node_modules/@layer0/core/deploy/bundle-ncc.js +30 -0
- package/node_modules/@layer0/core/deploy/bundle-nft.d.ts +7 -0
- package/node_modules/@layer0/core/deploy/bundle-nft.js +41 -0
- package/node_modules/@layer0/core/deploy/bundle-webpack.d.ts +11 -0
- package/node_modules/@layer0/core/deploy/bundle-webpack.js +127 -0
- package/node_modules/@layer0/core/deploy/index.d.ts +19 -0
- package/node_modules/@layer0/core/deploy/index.js +6 -0
- package/node_modules/@layer0/core/deploy/listSources.d.ts +11 -0
- package/node_modules/@layer0/core/deploy/listSources.js +18 -0
- package/node_modules/@layer0/core/deploy/paths.d.ts +27 -0
- package/node_modules/@layer0/core/deploy/paths.js +33 -0
- package/node_modules/@layer0/core/deploy/resolveInPackage.d.ts +7 -0
- package/node_modules/@layer0/core/deploy/resolveInPackage.js +21 -0
- package/node_modules/@layer0/core/deploy/routeToFiles.d.ts +14 -0
- package/node_modules/@layer0/core/deploy/routeToFiles.js +24 -0
- package/node_modules/@layer0/core/dev/DevServerOptions.d.ts +33 -0
- package/node_modules/@layer0/core/dev/DevServerOptions.js +2 -0
- package/node_modules/@layer0/core/dev/createDevServer.d.ts +8 -0
- package/node_modules/@layer0/core/dev/createDevServer.js +114 -0
- package/node_modules/@layer0/core/dev/index.d.ts +3 -0
- package/node_modules/@layer0/core/dev/index.js +6 -0
- package/node_modules/@layer0/core/dev/runLocalApp.d.ts +8 -0
- package/node_modules/@layer0/core/dev/runLocalApp.js +73 -0
- package/node_modules/@layer0/core/dev/serverlessCompatibilityMiddleware.d.ts +11 -0
- package/node_modules/@layer0/core/dev/serverlessCompatibilityMiddleware.js +30 -0
- package/node_modules/@layer0/core/edge/EdgeErrorPageResponseWriter.d.ts +12 -0
- package/node_modules/@layer0/core/edge/EdgeErrorPageResponseWriter.js +22 -0
- package/node_modules/@layer0/core/edge/EdgeResponseWriter.d.ts +122 -0
- package/node_modules/@layer0/core/edge/EdgeResponseWriter.js +451 -0
- package/node_modules/@layer0/core/edge/createEdgeConfig.d.ts +16 -0
- package/node_modules/@layer0/core/edge/createEdgeConfig.js +284 -0
- package/node_modules/@layer0/core/environment.d.ts +24 -0
- package/node_modules/@layer0/core/environment.js +42 -0
- package/node_modules/@layer0/core/errors/BackendFetchError.d.ts +11 -0
- package/node_modules/@layer0/core/errors/BackendFetchError.js +17 -0
- package/node_modules/@layer0/core/errors/FrameworkBuildError.d.ts +7 -0
- package/node_modules/@layer0/core/errors/FrameworkBuildError.js +26 -0
- package/node_modules/@layer0/core/index.d.ts +3 -0
- package/node_modules/@layer0/core/index.js +9 -0
- package/node_modules/@layer0/core/init/addToPackageJson.d.ts +7 -0
- package/node_modules/@layer0/core/init/addToPackageJson.js +22 -0
- package/node_modules/@layer0/core/init/index.d.ts +2 -0
- package/node_modules/@layer0/core/init/index.js +6 -0
- package/node_modules/@layer0/core/init/init.d.ts +5 -0
- package/node_modules/@layer0/core/init/init.js +17 -0
- package/node_modules/@layer0/core/lambda/JSBackend.d.ts +30 -0
- package/node_modules/@layer0/core/lambda/JSBackend.js +51 -0
- package/node_modules/@layer0/core/lambda/RequestListenerJSBackend.d.ts +8 -0
- package/node_modules/@layer0/core/lambda/RequestListenerJSBackend.js +19 -0
- package/node_modules/@layer0/core/lambda/adaptResponseEncodingToDownstream.d.ts +17 -0
- package/node_modules/@layer0/core/lambda/adaptResponseEncodingToDownstream.js +132 -0
- package/node_modules/@layer0/core/lambda/consoleWrapper.d.ts +16 -0
- package/node_modules/@layer0/core/lambda/consoleWrapper.js +127 -0
- package/node_modules/@layer0/core/lambda/getBodyLoggingData.d.ts +10 -0
- package/node_modules/@layer0/core/lambda/getBodyLoggingData.js +108 -0
- package/node_modules/@layer0/core/lambda/handler.d.ts +1 -0
- package/node_modules/@layer0/core/lambda/handler.js +91 -0
- package/node_modules/@layer0/core/lambda/handler.js.map +7 -0
- package/node_modules/@layer0/core/lambda/innerHandler.d.ts +7 -0
- package/node_modules/@layer0/core/lambda/innerHandler.js +181 -0
- package/node_modules/@layer0/core/lambda/lambdaInstance.d.ts +29 -0
- package/node_modules/@layer0/core/lambda/lambdaInstance.js +71 -0
- package/node_modules/@layer0/core/lambda/reqResMapper.d.ts +24 -0
- package/node_modules/@layer0/core/lambda/reqResMapper.js +286 -0
- package/node_modules/@layer0/core/lambda/stdStreamsWrapper.d.ts +31 -0
- package/node_modules/@layer0/core/lambda/stdStreamsWrapper.js +196 -0
- package/node_modules/@layer0/core/lambda/toJSBackend.d.ts +10 -0
- package/node_modules/@layer0/core/lambda/toJSBackend.js +23 -0
- package/node_modules/@layer0/core/node_modules/esbuild/LICENSE.md +21 -0
- package/node_modules/@layer0/core/node_modules/esbuild/README.md +3 -0
- package/node_modules/@layer0/core/node_modules/esbuild/bin/esbuild +223 -0
- package/node_modules/@layer0/core/node_modules/esbuild/install.js +301 -0
- package/node_modules/@layer0/core/node_modules/esbuild/lib/main.d.ts +716 -0
- package/node_modules/@layer0/core/node_modules/esbuild/lib/main.js +2532 -0
- package/node_modules/@layer0/core/node_modules/esbuild/node_modules/@ohos-ports/esbuild-openharmony-arm64/README.md +3 -0
- package/node_modules/@layer0/core/node_modules/esbuild/node_modules/@ohos-ports/esbuild-openharmony-arm64/bin/esbuild +0 -0
- package/node_modules/@layer0/core/node_modules/esbuild/node_modules/@ohos-ports/esbuild-openharmony-arm64/esbuild.wasm +0 -0
- package/node_modules/@layer0/core/node_modules/esbuild/node_modules/@ohos-ports/esbuild-openharmony-arm64/package.json +28 -0
- package/node_modules/@layer0/core/node_modules/esbuild/node_modules/@ohos-ports/esbuild-openharmony-arm64/wasm_exec.js +575 -0
- package/node_modules/@layer0/core/node_modules/esbuild/node_modules/@ohos-ports/esbuild-openharmony-arm64/wasm_exec_node.js +40 -0
- package/node_modules/@layer0/core/node_modules/esbuild/package.json +78 -0
- package/node_modules/@layer0/core/package.json +132 -0
- package/node_modules/@layer0/core/parser/parseRouter.d.ts +13 -0
- package/node_modules/@layer0/core/parser/parseRouter.js +77 -0
- package/node_modules/@layer0/core/plugins/PluginBase.d.ts +18 -0
- package/node_modules/@layer0/core/plugins/PluginBase.js +19 -0
- package/node_modules/@layer0/core/router/Backend.d.ts +69 -0
- package/node_modules/@layer0/core/router/Backend.js +176 -0
- package/node_modules/@layer0/core/router/BackendOptions.d.ts +11 -0
- package/node_modules/@layer0/core/router/BackendOptions.js +2 -0
- package/node_modules/@layer0/core/router/BaseResponseWriter.d.ts +65 -0
- package/node_modules/@layer0/core/router/BaseResponseWriter.js +81 -0
- package/node_modules/@layer0/core/router/BehindEdgeResponseWriterProxy.d.ts +4 -0
- package/node_modules/@layer0/core/router/BehindEdgeResponseWriterProxy.js +89 -0
- package/node_modules/@layer0/core/router/CacheManifest.d.ts +80 -0
- package/node_modules/@layer0/core/router/CacheManifest.js +83 -0
- package/node_modules/@layer0/core/router/CacheOptions.d.ts +171 -0
- package/node_modules/@layer0/core/router/CacheOptions.js +2 -0
- package/node_modules/@layer0/core/router/CustomCacheKey.d.ts +140 -0
- package/node_modules/@layer0/core/router/CustomCacheKey.js +272 -0
- package/node_modules/@layer0/core/router/GroupConfig.d.ts +7 -0
- package/node_modules/@layer0/core/router/GroupConfig.js +20 -0
- package/node_modules/@layer0/core/router/Groups.d.ts +7 -0
- package/node_modules/@layer0/core/router/Groups.js +21 -0
- package/node_modules/@layer0/core/router/Headers.d.ts +3 -0
- package/node_modules/@layer0/core/router/Headers.js +2 -0
- package/node_modules/@layer0/core/router/PathMatcher.d.ts +51 -0
- package/node_modules/@layer0/core/router/PathMatcher.js +73 -0
- package/node_modules/@layer0/core/router/Preload.d.ts +16 -0
- package/node_modules/@layer0/core/router/Preload.js +2 -0
- package/node_modules/@layer0/core/router/PreloadRequests.d.ts +23 -0
- package/node_modules/@layer0/core/router/PreloadRequests.js +66 -0
- package/node_modules/@layer0/core/router/Request.d.ts +74 -0
- package/node_modules/@layer0/core/router/Request.js +2 -0
- package/node_modules/@layer0/core/router/RequestContext.d.ts +12 -0
- package/node_modules/@layer0/core/router/RequestContext.js +11 -0
- package/node_modules/@layer0/core/router/Response.d.ts +55 -0
- package/node_modules/@layer0/core/router/Response.js +2 -0
- package/node_modules/@layer0/core/router/ResponseWriter.d.ts +1011 -0
- package/node_modules/@layer0/core/router/ResponseWriter.js +1341 -0
- package/node_modules/@layer0/core/router/Route.d.ts +124 -0
- package/node_modules/@layer0/core/router/Route.js +280 -0
- package/node_modules/@layer0/core/router/RouteCriteria.d.ts +68 -0
- package/node_modules/@layer0/core/router/RouteCriteria.js +2 -0
- package/node_modules/@layer0/core/router/RouteGroup.d.ts +157 -0
- package/node_modules/@layer0/core/router/RouteGroup.js +223 -0
- package/node_modules/@layer0/core/router/RouteGroupList.d.ts +45 -0
- package/node_modules/@layer0/core/router/RouteGroupList.js +73 -0
- package/node_modules/@layer0/core/router/Router.d.ts +439 -0
- package/node_modules/@layer0/core/router/Router.js +907 -0
- package/node_modules/@layer0/core/router/addBuiltInRoutes.d.ts +2 -0
- package/node_modules/@layer0/core/router/addBuiltInRoutes.js +58 -0
- package/node_modules/@layer0/core/router/addPreloadHeaders.d.ts +7 -0
- package/node_modules/@layer0/core/router/addPreloadHeaders.js +57 -0
- package/node_modules/@layer0/core/router/cacheManifestFromRouter.d.ts +6 -0
- package/node_modules/@layer0/core/router/cacheManifestFromRouter.js +85 -0
- package/node_modules/@layer0/core/router/createCustomCacheKey.d.ts +27 -0
- package/node_modules/@layer0/core/router/createCustomCacheKey.js +35 -0
- package/node_modules/@layer0/core/router/deriveSurrogateKeysFromJson.d.ts +36 -0
- package/node_modules/@layer0/core/router/deriveSurrogateKeysFromJson.js +70 -0
- package/node_modules/@layer0/core/router/index.d.ts +11 -0
- package/node_modules/@layer0/core/router/index.js +17 -0
- package/node_modules/@layer0/core/router/interpolateParams.d.ts +21 -0
- package/node_modules/@layer0/core/router/interpolateParams.js +150 -0
- package/node_modules/@layer0/core/router/loadRouter.d.ts +13 -0
- package/node_modules/@layer0/core/router/loadRouter.js +29 -0
- package/node_modules/@layer0/core/router/mergeQueryString.d.ts +1 -0
- package/node_modules/@layer0/core/router/mergeQueryString.js +23 -0
- package/node_modules/@layer0/core/router/normalizeCriteria.d.ts +6 -0
- package/node_modules/@layer0/core/router/normalizeCriteria.js +20 -0
- package/node_modules/@layer0/core/router/stream.d.ts +12 -0
- package/node_modules/@layer0/core/router/stream.js +30 -0
- package/node_modules/@layer0/core/router/universalRouteUtils.d.ts +55 -0
- package/node_modules/@layer0/core/router/universalRouteUtils.js +114 -0
- package/node_modules/@layer0/core/router/validateWriter.d.ts +41 -0
- package/node_modules/@layer0/core/router/validateWriter.js +120 -0
- package/node_modules/@layer0/core/serverless.yml +30 -0
- package/node_modules/@layer0/core/source.d.ts +9 -0
- package/node_modules/@layer0/core/source.js +17 -0
- package/node_modules/@layer0/core/test-utils/MockRequest.d.ts +15 -0
- package/node_modules/@layer0/core/test-utils/MockRequest.js +36 -0
- package/node_modules/@layer0/core/test-utils/MockResponse.d.ts +7 -0
- package/node_modules/@layer0/core/test-utils/MockResponse.js +24 -0
- package/node_modules/@layer0/core/test-utils/expect-extend.d.ts +1 -0
- package/node_modules/@layer0/core/test-utils/expect-extend.js +11 -0
- package/node_modules/@layer0/core/test-utils/index.d.ts +4 -0
- package/node_modules/@layer0/core/test-utils/index.js +11 -0
- package/node_modules/@layer0/core/test-utils/matchers/toBeCachedByTheBrowser.d.ts +19 -0
- package/node_modules/@layer0/core/test-utils/matchers/toBeCachedByTheBrowser.js +45 -0
- package/node_modules/@layer0/core/test-utils/matchers/toBeCachedByTheEdge.d.ts +19 -0
- package/node_modules/@layer0/core/test-utils/matchers/toBeCachedByTheEdge.js +38 -0
- package/node_modules/@layer0/core/test-utils/matchers/toBeCachedByTheServiceWorker.d.ts +19 -0
- package/node_modules/@layer0/core/test-utils/matchers/toBeCachedByTheServiceWorker.js +45 -0
- package/node_modules/@layer0/core/test-utils/matchers/toBeServedStale.d.ts +20 -0
- package/node_modules/@layer0/core/test-utils/matchers/toBeServedStale.js +50 -0
- package/node_modules/@layer0/core/test-utils/matchers/toHaveBody.d.ts +18 -0
- package/node_modules/@layer0/core/test-utils/matchers/toHaveBody.js +40 -0
- package/node_modules/@layer0/core/test-utils/matchers/toHaveHeader.d.ts +19 -0
- package/node_modules/@layer0/core/test-utils/matchers/toHaveHeader.js +43 -0
- package/node_modules/@layer0/core/test-utils/matchers.d.ts +6 -0
- package/node_modules/@layer0/core/test-utils/matchers.js +18 -0
- package/node_modules/@layer0/core/test-utils/utils/createRouteMock.d.ts +21 -0
- package/node_modules/@layer0/core/test-utils/utils/createRouteMock.js +27 -0
- package/node_modules/@layer0/core/test-utils/utils/getBackend.d.ts +13 -0
- package/node_modules/@layer0/core/test-utils/utils/getBackend.js +30 -0
- package/node_modules/@layer0/core/test-utils/utils/getMessage.d.ts +1 -0
- package/node_modules/@layer0/core/test-utils/utils/getMessage.js +16 -0
- package/node_modules/@layer0/core/test-utils/utils/runRoute.d.ts +10 -0
- package/node_modules/@layer0/core/test-utils/utils/runRoute.js +39 -0
- package/node_modules/@layer0/core/timing.d.ts +115 -0
- package/node_modules/@layer0/core/timing.js +200 -0
- package/node_modules/@layer0/core/transform/index.d.ts +1 -0
- package/node_modules/@layer0/core/transform/index.js +4 -0
- package/node_modules/@layer0/core/transform/transformMethod.d.ts +40 -0
- package/node_modules/@layer0/core/transform/transformMethod.js +58 -0
- package/node_modules/@layer0/core/types.d.ts +102 -0
- package/node_modules/@layer0/core/types.js +30 -0
- package/node_modules/@layer0/core/utils/Tasks.d.ts +32 -0
- package/node_modules/@layer0/core/utils/Tasks.js +80 -0
- package/node_modules/@layer0/core/utils/Validator.d.ts +18 -0
- package/node_modules/@layer0/core/utils/Validator.js +178 -0
- package/node_modules/@layer0/core/utils/bindParamsToPath.d.ts +15 -0
- package/node_modules/@layer0/core/utils/bindParamsToPath.js +49 -0
- package/node_modules/@layer0/core/utils/convertParamsToBackReferences.d.ts +16 -0
- package/node_modules/@layer0/core/utils/convertParamsToBackReferences.js +45 -0
- package/node_modules/@layer0/core/utils/convertStringMatcherToRegex.d.ts +7 -0
- package/node_modules/@layer0/core/utils/convertStringMatcherToRegex.js +26 -0
- package/node_modules/@layer0/core/utils/decode.d.ts +9 -0
- package/node_modules/@layer0/core/utils/decode.js +44 -0
- package/node_modules/@layer0/core/utils/esImport.d.ts +1 -0
- package/node_modules/@layer0/core/utils/esImport.js +9 -0
- package/node_modules/@layer0/core/utils/fs.d.ts +1 -0
- package/node_modules/@layer0/core/utils/fs.js +7 -0
- package/node_modules/@layer0/core/utils/get.d.ts +6 -0
- package/node_modules/@layer0/core/utils/get.js +19 -0
- package/node_modules/@layer0/core/utils/getPackageVersion.d.ts +7 -0
- package/node_modules/@layer0/core/utils/getPackageVersion.js +19 -0
- package/node_modules/@layer0/core/utils/has.d.ts +6 -0
- package/node_modules/@layer0/core/utils/has.js +15 -0
- package/node_modules/@layer0/core/utils/identity.d.ts +7 -0
- package/node_modules/@layer0/core/utils/identity.js +12 -0
- package/node_modules/@layer0/core/utils/index.d.ts +1 -0
- package/node_modules/@layer0/core/utils/index.js +4 -0
- package/node_modules/@layer0/core/utils/isEmpty.d.ts +6 -0
- package/node_modules/@layer0/core/utils/isEmpty.js +20 -0
- package/node_modules/@layer0/core/utils/isString.d.ts +1 -0
- package/node_modules/@layer0/core/utils/isString.js +6 -0
- package/node_modules/@layer0/core/utils/logo.d.ts +5 -0
- package/node_modules/@layer0/core/utils/logo.js +27 -0
- package/node_modules/@layer0/core/utils/mapValues.d.ts +7 -0
- package/node_modules/@layer0/core/utils/mapValues.js +16 -0
- package/node_modules/@layer0/core/utils/minBy.d.ts +8 -0
- package/node_modules/@layer0/core/utils/minBy.js +41 -0
- package/node_modules/@layer0/core/utils/nonWebpackRequire.d.ts +11 -0
- package/node_modules/@layer0/core/utils/nonWebpackRequire.js +28 -0
- package/node_modules/@layer0/core/utils/packageUtils.d.ts +12 -0
- package/node_modules/@layer0/core/utils/packageUtils.js +22 -0
- package/node_modules/@layer0/core/utils/ports.d.ts +5 -0
- package/node_modules/@layer0/core/utils/ports.js +7 -0
- package/node_modules/@layer0/core/utils/readBody.d.ts +7 -0
- package/node_modules/@layer0/core/utils/readBody.js +15 -0
- package/node_modules/@layer0/core/utils/readRawBody.d.ts +9 -0
- package/node_modules/@layer0/core/utils/readRawBody.js +21 -0
- package/node_modules/@layer0/core/utils/regExpEscape.d.ts +12 -0
- package/node_modules/@layer0/core/utils/regExpEscape.js +20 -0
- package/node_modules/@layer0/core/utils/requireInternal.d.ts +7 -0
- package/node_modules/@layer0/core/utils/requireInternal.js +24 -0
- package/node_modules/@layer0/core/utils/set.d.ts +10 -0
- package/node_modules/@layer0/core/utils/set.js +21 -0
- package/node_modules/@layer0/core/utils/toEdgeRegex.d.ts +11 -0
- package/node_modules/@layer0/core/utils/toEdgeRegex.js +23 -0
- package/node_modules/@layer0/core/utils/toHttpMethodMatchRegex.d.ts +12 -0
- package/node_modules/@layer0/core/utils/toHttpMethodMatchRegex.js +17 -0
- package/node_modules/@layer0/core/utils/toLower.d.ts +1 -0
- package/node_modules/@layer0/core/utils/toLower.js +9 -0
- package/node_modules/@layer0/core/utils/validateBackends.d.ts +5 -0
- package/node_modules/@layer0/core/utils/validateBackends.js +30 -0
- package/node_modules/@layer0/core/utils/watch.d.ts +10 -0
- package/node_modules/@layer0/core/utils/watch.js +17 -0
- package/package.json +47 -3
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const os_1 = require("os");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const environment_1 = require("../environment");
|
|
9
|
+
const nonWebpackRequire_1 = __importDefault(require("./nonWebpackRequire"));
|
|
10
|
+
// config.backends[x] domainOrIp schema
|
|
11
|
+
const domainOrIpSchema = {
|
|
12
|
+
$id: '/domainOrIpSchema',
|
|
13
|
+
type: 'string',
|
|
14
|
+
};
|
|
15
|
+
// config.backends[x] object schema
|
|
16
|
+
const backendObjectSchema = {
|
|
17
|
+
$id: '/backendObjectSchema',
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
domainOrIp: {
|
|
21
|
+
$ref: domainOrIpSchema.$id,
|
|
22
|
+
},
|
|
23
|
+
port: {
|
|
24
|
+
type: 'number',
|
|
25
|
+
// We allow all ports but we will always use HTTPS protocol no matter the port.
|
|
26
|
+
minimum: 1,
|
|
27
|
+
maximum: 65535,
|
|
28
|
+
},
|
|
29
|
+
hostHeader: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
},
|
|
32
|
+
disableCheckCert: {
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
},
|
|
35
|
+
firstByteTimeout: {
|
|
36
|
+
type: 'number',
|
|
37
|
+
},
|
|
38
|
+
basePath: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
required: ['domainOrIp'],
|
|
44
|
+
};
|
|
45
|
+
// config.backends schema
|
|
46
|
+
const backendSchema = {
|
|
47
|
+
$id: '/backendSchema',
|
|
48
|
+
type: 'object',
|
|
49
|
+
patternProperties: {
|
|
50
|
+
'^.*$': {
|
|
51
|
+
oneOf: [{ $ref: domainOrIpSchema.$id }, { $ref: backendObjectSchema.$id }],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
// layer0.config.js schema
|
|
56
|
+
const layer0FileConfigurationSchema = {
|
|
57
|
+
$id: '/layer0FileConfigurationSchema',
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
name: { type: 'string' },
|
|
61
|
+
team: { type: 'string' },
|
|
62
|
+
prerenderConcurrency: { type: 'number' },
|
|
63
|
+
production: { type: 'boolean' },
|
|
64
|
+
routes: { type: 'string' },
|
|
65
|
+
server: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
required: ['path'],
|
|
68
|
+
properties: { path: { type: 'string' }, export: { type: 'string' } },
|
|
69
|
+
},
|
|
70
|
+
includeFiles: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
},
|
|
73
|
+
sources: {
|
|
74
|
+
type: 'array',
|
|
75
|
+
items: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
backends: {
|
|
80
|
+
$ref: backendSchema.$id,
|
|
81
|
+
},
|
|
82
|
+
includeNodeModules: { type: 'boolean' },
|
|
83
|
+
connector: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
additionalProperties: false,
|
|
88
|
+
required: [],
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* An object used to validate an layer0 config.
|
|
92
|
+
*
|
|
93
|
+
* Example:
|
|
94
|
+
* ```js
|
|
95
|
+
* Validator.validateLayer0FileConfiguration(config)
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
class Validator {
|
|
99
|
+
/**
|
|
100
|
+
* Validates `layer0.config.js`. If the config is validated, it is returned; otherwise,
|
|
101
|
+
* an error is thrown.
|
|
102
|
+
* @param config Loaded layer0 configuration
|
|
103
|
+
* @returns The validated config
|
|
104
|
+
*/
|
|
105
|
+
static validateLayer0FileConfiguration(config) {
|
|
106
|
+
if (environment_1.isCloud())
|
|
107
|
+
return config;
|
|
108
|
+
// Ajv is really big, so we don't bother validating in the cloud - I've we've gotten this far, let 'er rip, baby!
|
|
109
|
+
const Ajv = nonWebpackRequire_1.default('ajv');
|
|
110
|
+
if (config.connector) {
|
|
111
|
+
try {
|
|
112
|
+
const configSchema = require(`${config.connector}/configSchema`);
|
|
113
|
+
// If a configuration schema exists for the connector, merge into the default schema
|
|
114
|
+
Object.assign(layer0FileConfigurationSchema.properties, configSchema);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// No config schema for connector, nothing to do here
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const ajv = new Ajv({
|
|
121
|
+
allErrors: true,
|
|
122
|
+
schemas: [
|
|
123
|
+
layer0FileConfigurationSchema,
|
|
124
|
+
backendSchema,
|
|
125
|
+
backendObjectSchema,
|
|
126
|
+
domainOrIpSchema,
|
|
127
|
+
],
|
|
128
|
+
});
|
|
129
|
+
let errors = [];
|
|
130
|
+
// the type cast on the following line is needed to get coverage to 100%. In theory getSchema can return undefined, but it won't since we are creating the schema ourselves.
|
|
131
|
+
const layer0SchemaValidator = ajv.getSchema(layer0FileConfigurationSchema.$id);
|
|
132
|
+
if (config.backends && config.backends.moov != null) {
|
|
133
|
+
// Don't allow providing moov backend in layer0.config.js
|
|
134
|
+
errors.push({
|
|
135
|
+
message: 'is a reserved backend name',
|
|
136
|
+
// eslint-disable-next-line quotes
|
|
137
|
+
dataPath: ".backends['moov']",
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// Don't allow providing static backend in layer0.config.js
|
|
141
|
+
if (config.backends && config.backends[constants_1.BACKENDS.static]) {
|
|
142
|
+
errors.push({
|
|
143
|
+
message: 'is a reserved backend name',
|
|
144
|
+
// eslint-disable-next-line quotes
|
|
145
|
+
dataPath: `.backends.${constants_1.BACKENDS.static}`,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// Don't allow providing js backend in layer0.config.js
|
|
149
|
+
if (config.backends && config.backends[constants_1.BACKENDS.js]) {
|
|
150
|
+
errors.push({
|
|
151
|
+
message: 'is a reserved backend name',
|
|
152
|
+
// eslint-disable-next-line quotes
|
|
153
|
+
dataPath: `.backends.${constants_1.BACKENDS.js}`,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// Run schema validation
|
|
157
|
+
if (!layer0SchemaValidator(config) && layer0SchemaValidator.errors) {
|
|
158
|
+
errors = [...errors, ...layer0SchemaValidator.errors];
|
|
159
|
+
}
|
|
160
|
+
// If errors length is not 0 throw error
|
|
161
|
+
if (errors.length) {
|
|
162
|
+
const errorsString = errors
|
|
163
|
+
.map((err, i) => {
|
|
164
|
+
let eString = `${i + 1}) config${err.dataPath}: ${err.message}`;
|
|
165
|
+
// @ts-ignore
|
|
166
|
+
if (err.keyword === 'additionalProperties') {
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
eString += ` '${err.params.additionalProperty}'`;
|
|
169
|
+
}
|
|
170
|
+
return eString;
|
|
171
|
+
})
|
|
172
|
+
.join(os_1.EOL);
|
|
173
|
+
throw new Error(`Layer0 configuration validation failed with errors: ${os_1.EOL}${errorsString}`);
|
|
174
|
+
}
|
|
175
|
+
return config;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.default = Validator;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const _default: (path: string, params: any) => string;
|
|
2
|
+
/**
|
|
3
|
+
* Binds params to path.
|
|
4
|
+
*
|
|
5
|
+
* Example:
|
|
6
|
+
* ```js
|
|
7
|
+
* bindParamsToPath('/:foo/:bar*', { foo: 'p1', bar: 'p2/p3' })
|
|
8
|
+
* ```
|
|
9
|
+
* Output: `/p1/p2/p3`
|
|
10
|
+
*
|
|
11
|
+
* @param path The path, with param substitutions in braces `{}`.
|
|
12
|
+
* @param params An object with keys matching the params in braces.
|
|
13
|
+
* @returns A string with the params substituted with their values.
|
|
14
|
+
*/
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Binds params to path.
|
|
5
|
+
*
|
|
6
|
+
* Example:
|
|
7
|
+
* ```js
|
|
8
|
+
* bindParamsToPath('/:foo/:bar*', { foo: 'p1', bar: 'p2/p3' })
|
|
9
|
+
* ```
|
|
10
|
+
* Output: `/p1/p2/p3`
|
|
11
|
+
*
|
|
12
|
+
* @param path The path, with param substitutions in braces `{}`.
|
|
13
|
+
* @param params An object with keys matching the params in braces.
|
|
14
|
+
* @returns A string with the params substituted with their values.
|
|
15
|
+
*/
|
|
16
|
+
exports.default = (path, params) => {
|
|
17
|
+
let p = path;
|
|
18
|
+
// We allow edge interpolation params which begin with `${` but we no longer
|
|
19
|
+
// allow old path options that only begin with `{`.
|
|
20
|
+
if (/(^|[^$]){/.test(path)) {
|
|
21
|
+
throw new Error(`{variable} syntax in the path option is no longer supported, use :variable instead (${path})`);
|
|
22
|
+
}
|
|
23
|
+
for (let paramName in params) {
|
|
24
|
+
let value = params[paramName];
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
value = value.join('/');
|
|
27
|
+
}
|
|
28
|
+
// Here we decide *not* to use path-to-regexp `compile()` function
|
|
29
|
+
// as bindParamsToPath is used by other string which are not paths.
|
|
30
|
+
// For example it is used to interpolate setHeader values, which can be a CORS header like
|
|
31
|
+
// 'https://www.domain.com/:path'. The ':' behind https is not a valid path-to-regexp expression.
|
|
32
|
+
// p = p.replace(new RegExp(`:${paramName}(\\?|\\*|\\(.*\\)[?*]?)?`, 'g'), value)
|
|
33
|
+
p = p.replace(new RegExp(`:${paramName}(\\([^)]*\\))?[?*+]?`, 'g'), value === undefined ? '' : value);
|
|
34
|
+
}
|
|
35
|
+
// For optional matchers (:path* and :path?), path may not be defined in params
|
|
36
|
+
// after matching a route but should still be replaced by a blank value
|
|
37
|
+
//
|
|
38
|
+
// ex: pathToRegexp.match('/public/:param?')('/').params returns {}
|
|
39
|
+
// so bindParamsToPath('/public/:param?', {}) should return '/public/'
|
|
40
|
+
//
|
|
41
|
+
p = p.replace(/:\w+(\*|\+|\?)?/, '');
|
|
42
|
+
// We un-escape '?' character that needed to be escape from path-to-regexp expression
|
|
43
|
+
// to *not* be considered as optional parameter matcher
|
|
44
|
+
p = p.replace('\\?', '?');
|
|
45
|
+
p = p
|
|
46
|
+
.replace(/\/+/g, '/') // finally dedupe /'s that result from missing optional parameters
|
|
47
|
+
.replace(/^([^:]+:)\//gi, '$1//'); // but don't replace http://domain with http:/domain
|
|
48
|
+
return p;
|
|
49
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replaces named parameters in the specified path with back references so
|
|
3
|
+
* that the edge can create a path using the matched params with a regex replace in VCL.
|
|
4
|
+
*
|
|
5
|
+
* **Note** this method can return a replacement that, when applied, can result in duplicated '/' characters,
|
|
6
|
+
* which must be collapsed. For example, if the route pattern is /:locale?/products and the url is '/products',
|
|
7
|
+
* where the optional parameter is not provided, url.replace(pattern, replacement) will result in '//products'
|
|
8
|
+
*
|
|
9
|
+
* @param matcher A route-parser route
|
|
10
|
+
* @param path The request path
|
|
11
|
+
* @returns A path with params replaced by back references
|
|
12
|
+
*/
|
|
13
|
+
export default function convertParamsToBackReferences(source: any | null | undefined, dest: string): string;
|
|
14
|
+
export declare function getBackReferences(path?: string): {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const bindParamsToPath_1 = __importDefault(require("./bindParamsToPath"));
|
|
7
|
+
const path_to_regexp_1 = require("path-to-regexp");
|
|
8
|
+
/**
|
|
9
|
+
* Replaces named parameters in the specified path with back references so
|
|
10
|
+
* that the edge can create a path using the matched params with a regex replace in VCL.
|
|
11
|
+
*
|
|
12
|
+
* **Note** this method can return a replacement that, when applied, can result in duplicated '/' characters,
|
|
13
|
+
* which must be collapsed. For example, if the route pattern is /:locale?/products and the url is '/products',
|
|
14
|
+
* where the optional parameter is not provided, url.replace(pattern, replacement) will result in '//products'
|
|
15
|
+
*
|
|
16
|
+
* @param matcher A route-parser route
|
|
17
|
+
* @param path The request path
|
|
18
|
+
* @returns A path with params replaced by back references
|
|
19
|
+
*/
|
|
20
|
+
function convertParamsToBackReferences(source, dest) {
|
|
21
|
+
if (source == null)
|
|
22
|
+
return dest;
|
|
23
|
+
const sourceTokens = getBackReferences(source);
|
|
24
|
+
return bindParamsToPath_1.default(dest, sourceTokens);
|
|
25
|
+
}
|
|
26
|
+
exports.default = convertParamsToBackReferences;
|
|
27
|
+
function getBackReferences(path) {
|
|
28
|
+
if (!path)
|
|
29
|
+
return {};
|
|
30
|
+
// In case path is an absolute path
|
|
31
|
+
const absolutePathMatch = path.match(/https?:\/\/[^/]+(.*)/);
|
|
32
|
+
if (absolutePathMatch) {
|
|
33
|
+
path = `/${absolutePathMatch[1]}`;
|
|
34
|
+
}
|
|
35
|
+
// Back reference counting starts from 1
|
|
36
|
+
let backReferenceCounter = 1;
|
|
37
|
+
const references = {};
|
|
38
|
+
path_to_regexp_1.parse(path).forEach(token => {
|
|
39
|
+
if (typeof token !== 'string') {
|
|
40
|
+
references[token.name] = `\\${backReferenceCounter++}`;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return references;
|
|
44
|
+
}
|
|
45
|
+
exports.getBackReferences = getBackReferences;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const toEdgeRegex_1 = __importDefault(require("./toEdgeRegex"));
|
|
7
|
+
/**
|
|
8
|
+
* Returns either null or regex even if input is string matcher.
|
|
9
|
+
*
|
|
10
|
+
* @param potentialRegex
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
function convertStringMatcherToRegex(potentialRegex) {
|
|
14
|
+
let regex;
|
|
15
|
+
if (potentialRegex === null) {
|
|
16
|
+
regex = null;
|
|
17
|
+
}
|
|
18
|
+
else if (typeof potentialRegex === 'string') {
|
|
19
|
+
regex = toEdgeRegex_1.default(new RegExp(`^${potentialRegex}$`, 'i'));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
regex = toEdgeRegex_1.default(potentialRegex);
|
|
23
|
+
}
|
|
24
|
+
return regex;
|
|
25
|
+
}
|
|
26
|
+
exports.default = convertStringMatcherToRegex;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Response from '../router/Response';
|
|
2
|
+
/**
|
|
3
|
+
* If needed decodes the body in place from the response content-encoding.
|
|
4
|
+
* Removes the content-encoding header and updates the content-length as the
|
|
5
|
+
* decoded body has no encoding and will have a different length.
|
|
6
|
+
* @param response
|
|
7
|
+
* @returns True if decoding happened or wasn't needed, false otherwise
|
|
8
|
+
*/
|
|
9
|
+
export default function decode(response: Response): Boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const zlib_1 = require("zlib");
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
/**
|
|
6
|
+
* If needed decodes the body in place from the response content-encoding.
|
|
7
|
+
* Removes the content-encoding header and updates the content-length as the
|
|
8
|
+
* decoded body has no encoding and will have a different length.
|
|
9
|
+
* @param response
|
|
10
|
+
* @returns True if decoding happened or wasn't needed, false otherwise
|
|
11
|
+
*/
|
|
12
|
+
function decode(response) {
|
|
13
|
+
var _a;
|
|
14
|
+
const contentEncoding = (_a = response.getHeader(constants_1.HTTP_HEADERS.contentEncoding)) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
15
|
+
// When there is no encoding, then there is nothing to decode.
|
|
16
|
+
if (!contentEncoding) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
switch (contentEncoding) {
|
|
20
|
+
case constants_1.GZIP_ENCODING: {
|
|
21
|
+
if (!Buffer.isBuffer(response.body)) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
response.body = zlib_1.gunzipSync(response.body);
|
|
25
|
+
response.removeHeader(constants_1.HTTP_HEADERS.contentEncoding);
|
|
26
|
+
response.setHeader(constants_1.HTTP_HEADERS.contentLength, Buffer.byteLength(response.body));
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
case constants_1.BROTLI_ENCODING: {
|
|
30
|
+
if (!Buffer.isBuffer(response.body)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
response.body = zlib_1.brotliDecompressSync(response.body);
|
|
34
|
+
response.removeHeader(constants_1.HTTP_HEADERS.contentEncoding);
|
|
35
|
+
response.setHeader(constants_1.HTTP_HEADERS.contentLength, Buffer.byteLength(response.body));
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
default: {
|
|
39
|
+
// We cannot decode the body for unsupported encodings.
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = decode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function esImport(path: string): Promise<any>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* istanbul ignore file */
|
|
4
|
+
// Workaround for importing ES module within CJS module
|
|
5
|
+
// https://github.com/microsoft/TypeScript/issues/43329#issuecomment-1008361973
|
|
6
|
+
async function esImport(path) {
|
|
7
|
+
return Function(`return import("${path}")`)();
|
|
8
|
+
}
|
|
9
|
+
exports.default = esImport;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* `get` function instead of importing lodash.
|
|
5
|
+
*
|
|
6
|
+
* Note that this function is not entirely equivalent to lodash's but it uses far less space in the bundle.
|
|
7
|
+
*/
|
|
8
|
+
function get(object, path) {
|
|
9
|
+
let value = object;
|
|
10
|
+
const components = path.split('.');
|
|
11
|
+
for (let component of components) {
|
|
12
|
+
if (typeof value === 'undefined') {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
value = value[component];
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
exports.default = get;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import SemVer from 'semver/classes/semver';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the semver version of the specified package. Returns null if the package cannot be found or does not have a main export
|
|
4
|
+
* @param packageName
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export default function getPackageVersion(packageName: string): SemVer | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const parse_1 = __importDefault(require("semver/functions/parse"));
|
|
7
|
+
const resolve_package_path_1 = __importDefault(require("resolve-package-path"));
|
|
8
|
+
/**
|
|
9
|
+
* Returns the semver version of the specified package. Returns null if the package cannot be found or does not have a main export
|
|
10
|
+
* @param packageName
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
function getPackageVersion(packageName) {
|
|
14
|
+
// This will return the path to the main module, which will not necessarily be in the root
|
|
15
|
+
// directory of the package. Next.js is one such example.
|
|
16
|
+
const packagePath = resolve_package_path_1.default(packageName, process.cwd());
|
|
17
|
+
return packagePath ? parse_1.default(eval('require')(packagePath).version) : null;
|
|
18
|
+
}
|
|
19
|
+
exports.default = getPackageVersion;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const get_1 = __importDefault(require("./get"));
|
|
7
|
+
/**
|
|
8
|
+
* `has` function instead of importing lodash.
|
|
9
|
+
*
|
|
10
|
+
* Note that this function is not entirely equivalent to lodash's but it uses far less space in the bundle.
|
|
11
|
+
*/
|
|
12
|
+
function has(object, path) {
|
|
13
|
+
return !!get_1.default(object, path);
|
|
14
|
+
}
|
|
15
|
+
exports.default = has;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Identity function instead of importing lodash.
|
|
5
|
+
*
|
|
6
|
+
* @param x Any object
|
|
7
|
+
* @returns The same object
|
|
8
|
+
*/
|
|
9
|
+
function identity(x) {
|
|
10
|
+
return x;
|
|
11
|
+
}
|
|
12
|
+
exports.default = identity;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as nonWebpackRequire } from './nonWebpackRequire';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* `isEmpty` function instead of importing lodash.
|
|
5
|
+
*
|
|
6
|
+
* Note that this function is not entirely equivalent to lodash's but it uses far less space in the bundle.
|
|
7
|
+
*/
|
|
8
|
+
function isEmpty(value) {
|
|
9
|
+
if (!value) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (typeof value.length === 'number') {
|
|
13
|
+
return !value.length;
|
|
14
|
+
}
|
|
15
|
+
if (typeof value === 'object' && Object.keys(value).length) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
exports.default = isEmpty;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isString(x: any): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nonWebpackRequire_1 = __importDefault(require("./nonWebpackRequire"));
|
|
7
|
+
let logo;
|
|
8
|
+
let label;
|
|
9
|
+
let info = 'info', warn = 'warn', error = 'error';
|
|
10
|
+
try {
|
|
11
|
+
// We don't bundle chalk in the user lambda because it is a large module that is not required
|
|
12
|
+
// during runtime. Thus if it cannot be required we default to plain ASCII logo definitions.
|
|
13
|
+
const chalk = nonWebpackRequire_1.default('chalk');
|
|
14
|
+
const c1 = chalk.hex('D355A7');
|
|
15
|
+
label = chalk.grey(`Layer0`);
|
|
16
|
+
logo = chalk.bold(`Layer${c1('0')}`);
|
|
17
|
+
info = chalk.cyan(info);
|
|
18
|
+
warn = chalk.yellow(warn);
|
|
19
|
+
error = chalk.red(error);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
logo = label = 'Layer0';
|
|
23
|
+
}
|
|
24
|
+
exports.infoLogLabel = `${label} ${info} -`;
|
|
25
|
+
exports.warnLogLabel = `${label} ${warn} -`;
|
|
26
|
+
exports.errorLogLabel = `${label} ${error} -`;
|
|
27
|
+
exports.default = logo;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Lightweight port of lodash.mapValues
|
|
5
|
+
* https://lodash.com/docs/4.17.15#mapValues
|
|
6
|
+
* @param obj
|
|
7
|
+
* @param callback
|
|
8
|
+
*/
|
|
9
|
+
function mapValues(obj, callback) {
|
|
10
|
+
const result = {};
|
|
11
|
+
for (let [key, value] of Object.entries(obj)) {
|
|
12
|
+
result[key] = callback(value, key);
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
exports.default = mapValues;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `minBy` function instead of importing lodash.
|
|
3
|
+
*
|
|
4
|
+
* Note that this function is not entirely equivalent to lodash's but it uses far less space in the bundle.
|
|
5
|
+
*
|
|
6
|
+
* @param collection Array of items of type T
|
|
7
|
+
*/
|
|
8
|
+
export default function minBy<T>(collection: T[] | null | undefined, iteratee: (t: T) => any): T | undefined;
|