Commit 3b36a371 authored by Guy Bedford's avatar Guy Bedford Committed by Joe Haddad

json5

parent 9831d3b3
......@@ -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)
}
......
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]>
......
......@@ -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",
......
......@@ -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',
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment