-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[peggy] compile peggy grammars on demand
- Loading branch information
spalger
committed
Nov 19, 2022
1 parent
73cf0a2
commit 0214607
Showing
65 changed files
with
1,155 additions
and
237 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library") | ||
load("//src/dev/bazel:index.bzl", "pkg_npm") | ||
|
||
PKG_DIRNAME = "kbn-ambient-common-types" | ||
PKG_REQUIRE_NAME = "@kbn/ambient-common-types" | ||
|
||
SRCS = glob( | ||
[ | ||
"*.d.ts", | ||
] | ||
) | ||
|
||
filegroup( | ||
name = "srcs", | ||
srcs = SRCS, | ||
) | ||
|
||
NPM_MODULE_EXTRA_FILES = [ | ||
"package.json", | ||
] | ||
|
||
# In this array place runtime dependencies, including other packages and NPM packages | ||
# which must be available for this code to run. | ||
# | ||
# To reference other packages use: | ||
# "//repo/relative/path/to/package" | ||
# eg. "//packages/kbn-utils" | ||
# | ||
# To reference a NPM package use: | ||
# "@npm//name-of-package" | ||
# eg. "@npm//lodash" | ||
RUNTIME_DEPS = [ | ||
] | ||
|
||
js_library( | ||
name = PKG_DIRNAME, | ||
srcs = SRCS + NPM_MODULE_EXTRA_FILES, | ||
deps = RUNTIME_DEPS, | ||
package_name = PKG_REQUIRE_NAME, | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
pkg_npm( | ||
name = "npm_module", | ||
deps = [":" + PKG_DIRNAME], | ||
) | ||
|
||
filegroup( | ||
name = "build", | ||
srcs = [":npm_module"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
alias( | ||
name = "npm_module_types", | ||
actual = ":" + PKG_DIRNAME, | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
id: kibDevDocsOpsAmbientCommonTypes | ||
slug: /kibana-dev-docs/ops/ambient-common-types | ||
title: "@kbn/ambient-common-types" | ||
description: A package holding ambient type definitions for files that are expected to run on the server and the browser | ||
date: 2022-05-18 | ||
tags: ['kibana', 'dev', 'contributor', 'operations', 'ambient', 'ui', 'common', 'server', 'types'] | ||
--- | ||
|
||
This package holds ambient typescript definitions which should be included in projects which are expected to run on the server and the browser. | ||
|
||
## Plugins | ||
These types will automatically be included for plugins. | ||
|
||
## Packages | ||
|
||
To include these types in a package: | ||
|
||
- add `"//packages/kbn-ambient-ui-types:npm_module_types"` to the `TYPES_DEPS` portion of the `BUILD.bazel` file. | ||
- add `"@kbn/ambient-ui-types"` to the `types` portion of the `tsconfig.json` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
/** | ||
* These ambient types are used to define default types for anything which is | ||
* supported in both server/browser environments. | ||
*/ | ||
|
||
/** | ||
* peggy grammars are built automatically on import in both browser/server | ||
*/ | ||
declare module '*.peggy' { | ||
export interface ParserOptions { | ||
[key: string]: any; | ||
/** | ||
* Object that will be attached to the each `LocationRange` object created by | ||
* the parser. For example, this can be path to the parsed file or even the | ||
* File object. | ||
*/ | ||
grammarSource?: any; | ||
startRule?: string; | ||
tracer?: ParserTracer; | ||
} | ||
|
||
/** | ||
* parse `input` using the peggy grammer | ||
* @param input code to parse | ||
* @param options parse options | ||
*/ | ||
export function parse(input: string, options?: ParserOptions): any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
module.exports = { | ||
preset: '@kbn/test/jest_node', | ||
rootDir: '../..', | ||
roots: ['<rootDir>/packages/kbn-ambient-common-types'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "shared-common", | ||
"id": "@kbn/ambient-common-types", | ||
"owner": "@elastic/kibana-operations", | ||
"devOnly": true, | ||
"runtimeDeps": [], | ||
"typeDeps": [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "@kbn/ambient-common-types", | ||
"private": true, | ||
"version": "1.0.0", | ||
"main": "./target_node/index.js", | ||
"types": "./target_types/index.d.ts", | ||
"license": "SSPL-1.0 OR Elastic License 2.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "../../tsconfig.bazel.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"outDir": "target_types", | ||
"types": [ | ||
"jest", | ||
"node" | ||
] | ||
}, | ||
"include": [ | ||
"**/*.ts", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.