This commit is contained in:
Guy Bedford 2020-03-28 18:36:15 -06:00 committed by Joe Haddad
parent 9831d3b3e2
commit 3b36a3711c
5 changed files with 15 additions and 3 deletions

View file

@ -60,7 +60,7 @@ const escapePathVariables = (value: any) => {
}
function parseJsonFile(path: string) {
const JSON5 = require('json5')
const JSON5 = require('next/dist/compiled/json5')
const contents = readFileSync(path)
return JSON5.parse(contents)
}

View file

@ -1,6 +1,6 @@
import findUp from 'find-up'
import fs from 'fs'
import JSON5 from 'json5'
import JSON5 from 'next/dist/compiled/json5'
type RecursivePartial<T> = {
[P in keyof T]?: RecursivePartial<T[P]>

View file

@ -71,7 +71,6 @@
"fork-ts-checker-webpack-plugin": "3.1.1",
"ignore-loader": "0.1.2",
"jest-worker": "24.9.0",
"json5": "2.1.2",
"jsonwebtoken": "8.5.1",
"launch-editor": "2.2.1",
"loader-utils": "2.0.0",
@ -193,6 +192,7 @@
"http-proxy": "1.18.0",
"is-docker": "2.0.0",
"is-wsl": "2.1.1",
"json5": "2.1.2",
"nanoid": "2.0.3",
"resolve": "1.11.0",
"taskr": "1.1.0",

View file

@ -363,6 +363,13 @@ export async function ncc_is_wsl(task, opts) {
.target('dist/compiled/is-wsl')
}
// eslint-disable-next-line camelcase
export async function ncc_json5(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('json5')))
.ncc({ packageName: 'json5' })
.target('dist/compiled/json5')
}
// eslint-disable-next-line camelcase
export async function ncc_nanoid(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('nanoid')))
@ -433,6 +440,7 @@ export async function precompile(task) {
'ncc_http_proxy',
'ncc_is_docker',
'ncc_is_wsl',
'ncc_json5',
'ncc_nanoid',
'ncc_resolve',
'ncc_text_table',

View file

@ -116,6 +116,10 @@ declare module 'next/dist/compiled/is-wsl' {
import m from 'is-wsl'
export = m
}
declare module 'next/dist/compiled/json5' {
import m from 'json5'
export = m
}
declare module 'next/dist/compiled/nanoid/index.js' {
function nanoid(size?: number): string
export = nanoid