Skip to content

Commit

Permalink
Use wild-wild-parser
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Mar 20, 2022
1 parent 18127a0 commit a738ecb
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 17 deletions.
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"tmp-promise": "^3.0.2",
"update-notifier": "^5.0.1",
"uuid": "^8.3.2",
"wild-wild-parser": "^1.0.0",
"wrap-ansi": "^8.0.1",
"write-file-atomic": "^4.0.1",
"yargs": "^17.3.1"
Expand Down
3 changes: 2 additions & 1 deletion src/config/load/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* eslint-disable max-lines */
import { dirname } from 'path'

import { serializePath } from 'wild-wild-parser'

import { UserError } from '../../error/main.js'
import { addBases, getBasePath } from '../cwd.js'
import { deepMerge } from '../merge.js'
import { serializePath } from '../normalize/lib/wild_wild_parser/main.js'
import { get, set, list } from '../normalize/lib/wild_wild_path/main.js'

import { loadConfigContents } from './contents.js'
Expand Down
3 changes: 2 additions & 1 deletion src/config/normalize/lib/entry.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { isSamePath } from 'wild-wild-parser'

import { applyRule } from './apply.js'
import { addMoves } from './move.js'
import { getOpts } from './opts.js'
import { addWarnings } from './warn.js'
import { isSamePath } from './wild_wild_parser/main.js'
import { set, remove } from './wild_wild_path/main.js'

// Apply rule for a specific entry
Expand Down
3 changes: 2 additions & 1 deletion src/config/normalize/lib/modify.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { normalizePath } from 'wild-wild-parser'

import { callValueFunc, callUserFunc, getValidateExampleError } from './call.js'
import { resolvePath } from './path.js'
import { transformValue } from './transform.js'
import { getWarnings } from './warn.js'
import { normalizePath } from './wild_wild_parser/main.js'
import { has } from './wild_wild_path/main.js'

// Once the initial value has been computed, apply validation and transforms,
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/move.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isParentPath, isSamePath } from './wild_wild_parser/main.js'
import { isParentPath, isSamePath } from 'wild-wild-parser'

// When a property is moved to another, record it.
export const addMoves = function (moves, newPaths, oldNamePath) {
Expand Down
3 changes: 2 additions & 1 deletion src/config/normalize/lib/opts.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { normalizePath, serializePath } from 'wild-wild-parser'

import { callUserFunc } from './call.js'
import { getCwd } from './cwd.js'
import { applyMoves } from './move.js'
import { getPrefix, DEFAULT_PREFIX } from './prefix.js'
import { normalizePath, serializePath } from './wild_wild_parser/main.js'

// Retrieve `opts` passed to most methods.
// `funcOpts` are passed to user-provided functions.
Expand Down
3 changes: 2 additions & 1 deletion src/config/normalize/lib/rule.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { normalizeQuery, serializeQuery } from './wild_wild_parser/main.js'
import { normalizeQuery, serializeQuery } from 'wild-wild-parser'

import { get } from './wild_wild_path/main.js'

// Validate and normalize rules.
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/transform.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import isPlainObj from 'is-plain-obj'
import pReduce from 'p-reduce'
import { normalizePath } from 'wild-wild-parser'

import { callValueFunc } from './call.js'
import { normalizePath } from './wild_wild_parser/main.js'

// Apply `transform(value, opts)` which transforms the value set by the user.
// If can also delete it by returning `undefined`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isSamePath, isSameToken } from '../../wild_wild_parser/main.js'
import { isSamePath, isSameToken } from 'wild-wild-parser'

// Remove duplicate entries
export const removeDuplicates = function (entries) {
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/wild_wild_path/iterate/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { normalizeQuery } from '../../wild_wild_parser/main.js'
import { normalizeQuery } from 'wild-wild-parser'

import { iterateChildEntries } from './children.js'
import { removeDuplicates } from './duplicate.js'
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/wild_wild_path/tokens/any_deep.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getTokenType as getTokenTypeName } from '../../wild_wild_parser/main.js'
import { getTokenType as getTokenTypeName } from 'wild-wild-parser'

// Handle ** recursion.
// It matches 0, 1 or more levels.
Expand Down
2 changes: 1 addition & 1 deletion src/config/normalize/lib/wild_wild_path/tokens/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getTokenType as getTokenTypeName } from '../../wild_wild_parser/main.js'
import { getTokenType as getTokenTypeName } from 'wild-wild-parser'

import { ANY_TOKEN } from './any.js'
import { ANY_DEEP_TOKEN } from './any_deep.js'
Expand Down
3 changes: 2 additions & 1 deletion src/config/normalize/lib/wild_wild_utils/include/reduce.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { isParentPath } from '../../wild_wild_parser/main.js'
import { isParentPath } from 'wild-wild-parser'

import { list } from '../../wild_wild_path/main.js'

// Modify a target object multiple times for each matched property.
Expand Down
7 changes: 2 additions & 5 deletions src/config/plugin/lib/shared.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { inspect } from 'util'

import {
serializeQuery,
normalizeQuery,
getTokenType,
} from '../../normalize/lib/wild_wild_parser/main.js'
import { serializeQuery, normalizeQuery, getTokenType } from 'wild-wild-parser'

import { pick } from '../../normalize/lib/wild_wild_utils/main.js'

import { UserError } from './error.js'
Expand Down

0 comments on commit a738ecb

Please sign in to comment.