chore: update flux parser
- better error handling - updated language specspull/18046/head
parent
a280a50f99
commit
7dd2ea9b09
|
@ -130,9 +130,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@influxdata/clockface": "2.1.0",
|
||||
"@influxdata/flux": "^0.4.0",
|
||||
"@influxdata/flux": "^0.5.1",
|
||||
"@influxdata/flux-lsp-browser": "^0.5.6",
|
||||
"@influxdata/flux-parser": "^0.3.0",
|
||||
"@influxdata/giraffe": "0.18.0",
|
||||
"@influxdata/influx": "0.5.5",
|
||||
"@influxdata/influxdb-templates": "0.9.0",
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import {File} from 'src/types/ast'
|
||||
|
||||
/*
|
||||
NOTE: This is a work around for flux being generated (from rust) for the browser and jest tests running in
|
||||
a node environment (this is only for handling tests). If a test requires a specific AST result
|
||||
then you will need to mock that out in the test.
|
||||
*/
|
||||
export const parse = (script): File => {
|
||||
if (window) {
|
||||
return require('@influxdata/flux').parse(script)
|
||||
} else {
|
||||
return {
|
||||
type: 'File',
|
||||
package: {
|
||||
name: {
|
||||
name: 'fake',
|
||||
type: 'Identifier',
|
||||
},
|
||||
type: 'PackageClause',
|
||||
},
|
||||
imports: [],
|
||||
body: [],
|
||||
}
|
||||
}
|
||||
}
|
|
@ -179,7 +179,6 @@ function isTimeCall(node: CallExpression): boolean {
|
|||
|
||||
function isRangeNode(node: Node) {
|
||||
return (
|
||||
get(node, 'type') === 'CallExpression' &&
|
||||
get(node, 'callee.type') === 'Identifier' &&
|
||||
get(node, 'callee.name') === 'range'
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Libraries
|
||||
import {parse} from '@influxdata/flux-parser'
|
||||
import {parse} from 'src/external/parser'
|
||||
import {get} from 'lodash'
|
||||
|
||||
// API
|
||||
|
|
|
@ -22,7 +22,7 @@ describe('getWindowPeriodVariable', () => {
|
|||
})
|
||||
|
||||
test('should return a dynamic windowPeriod depending on the timeRange that is input', () => {
|
||||
jest.mock('@influxdata/flux-parser', () => {
|
||||
jest.mock('src/external/parser', () => {
|
||||
return {
|
||||
parse: jest.fn(() => ({
|
||||
type: 'File',
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// APIs
|
||||
import {parse} from '@influxdata/flux-parser'
|
||||
import {parse} from 'src/external/parser'
|
||||
|
||||
// Utils
|
||||
import {getMinDurationFromAST} from 'src/shared/utils/getMinDurationFromAST'
|
||||
|
|
|
@ -43,10 +43,6 @@ module.exports = {
|
|||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /flux_parser_bg.wasm$/,
|
||||
type: 'webassembly/experimental',
|
||||
},
|
||||
{
|
||||
test: /flux_bg.wasm$/,
|
||||
type: 'webassembly/experimental',
|
||||
|
|
13
ui/yarn.lock
13
ui/yarn.lock
|
@ -1021,15 +1021,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@influxdata/flux-lsp-browser/-/flux-lsp-browser-0.5.6.tgz#ca0d57c713ca4bbca4828b9c26b86c3ec4781249"
|
||||
integrity sha512-9NP4zl2nLNy4C9lyGfqf09C41w1ENINXg1X5O+LZFgqbc2oRF3HyZFgDbUfPRgsWUAQrjahSNm29bt/KnOgy2w==
|
||||
|
||||
"@influxdata/flux-parser@^0.3.0":
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@influxdata/flux-parser/-/flux-parser-0.3.0.tgz#b63123ac814ad32c65e46a4097ba3d8b959416a5"
|
||||
integrity sha512-nsm801l60kXFulcSWA2YH2YRz9oSsMlTK9Evn6Og9BoQnQMcwUsSUEug8mQRIUljnkNYV58JSs0W0mP8h7Y/ZQ==
|
||||
|
||||
"@influxdata/flux@^0.4.0":
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/@influxdata/flux/-/flux-0.4.0.tgz#7780f1344175c3dc784fb935e7224c6758d44846"
|
||||
integrity sha512-m678aFy2fUMlBFwbZ8dG1yawuLUAzOEJm6jPdZR6ezUW/Z07mLk1XwMEbCMk7vFkx1f7cbZ0Yxe/sDt0uwRcxA==
|
||||
"@influxdata/flux@^0.5.1":
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/@influxdata/flux/-/flux-0.5.1.tgz#e39e7a7af9163fc9494422c8fed77f3ae1b68f56"
|
||||
integrity sha512-GHlkXBhSdJ2m56JzDkbnKPAqLj3/lexPooacu14AWTO4f2sDGLmzM7r0AxgdtU1M2x7EXNBwgGOI5EOAdN6mkw==
|
||||
|
||||
"@influxdata/giraffe@0.18.0":
|
||||
version "0.18.0"
|
||||
|
|
Loading…
Reference in New Issue