ncc nanoid (#6768)

This commit is contained in:
Tim Neutkens 2019-03-24 14:21:30 +01:00 committed by GitHub
parent 355078c350
commit a8d08d3920
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 3 deletions

View file

@ -1,5 +1,5 @@
import { join } from 'path'
import nanoid from 'nanoid'
import nanoid from 'next/dist/compiled/nanoid/index.js'
import loadConfig from 'next-server/next-config'
import { PHASE_PRODUCTION_BUILD } from 'next-server/constants'
import getBaseWebpackConfig from './webpack-config'

View file

@ -67,7 +67,6 @@
"loader-utils": "1.1.0",
"magic-string": "0.25.2",
"mkdirp": "0.5.1",
"nanoid": "1.2.1",
"next-server": "8.0.4-canary.19",
"prop-types": "15.6.2",
"prop-types-exact": "1.2.0",
@ -117,6 +116,7 @@
"@types/webpack-sources": "0.1.5",
"@zeit/ncc": "0.15.2",
"taskr": "1.1.0",
"nanoid": "1.2.1",
"text-table": "0.2.0",
"typescript": "3.1.6",
"unistore": "3.2.1"

View file

@ -20,6 +20,14 @@ const babelOpts = {
]
}
// eslint-disable-next-line camelcase
export async function ncc_nanoid (task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('nanoid')))
.ncc({ packageName: 'nanoid' })
.target('dist/compiled/nanoid')
}
// eslint-disable-next-line camelcase
export async function ncc_unistore (task, opts) {
await task
@ -37,7 +45,7 @@ export async function ncc_text_table (task, opts) {
}
export async function precompile (task) {
await task.parallel(['ncc_unistore', 'ncc_text_table'])
await task.parallel(['ncc_unistore', 'ncc_nanoid', 'ncc_text_table'])
}
export async function compile (task) {

View file

@ -3,6 +3,13 @@ declare module 'next-server/next-config';
declare module 'next-server/constants';
declare module 'webpack/lib/GraphHelpers';
declare module 'next/dist/compiled/nanoid/index.js' {
function nanoid(size?: number): string;
export = nanoid;
}
declare module 'arg' {
function arg<T extends arg.Spec>(spec: T, options?: {argv?: string[], permissive?: boolean}): arg.Result<T>;