@based/cli
Advanced tools
Comparing version 7.0.1 to 7.0.2-alpha.0
@@ -39,4 +39,4 @@ import { readdir } from 'fs/promises'; | ||
}, true); | ||
const { publicPath } = await envAdmin.call('based:env-info').catch(() => { | ||
console.error('Could not get env info.'); | ||
const { publicPath } = await envAdmin.call('based:env-info').catch((err) => { | ||
console.error('Could not get env info.\n', err); | ||
process.exit(1); | ||
@@ -139,3 +139,3 @@ }); | ||
const res = await envAdmin.stream('based:set-function', { | ||
contents: fn.contents.buffer, | ||
contents: fn.contents, | ||
payload: { | ||
@@ -146,2 +146,5 @@ checksum, | ||
}); | ||
if (res.error) { | ||
throw new Error(res.error); | ||
} | ||
const { distId } = res; | ||
@@ -151,3 +154,3 @@ if (distId) { | ||
await envAdmin.stream('based:set-sourcemap', { | ||
contents: sourcemap.contents.buffer, | ||
contents: sourcemap.contents, | ||
payload: { | ||
@@ -215,3 +218,3 @@ distId, | ||
const { src: url } = await envAdmin.stream('db:file-upload', { | ||
contents: contents.buffer, | ||
contents: contents, | ||
fileName, | ||
@@ -218,0 +221,0 @@ mimeType: mimeTypes.lookup(fileName.substring(fileName.lastIndexOf('.'))), |
@@ -222,6 +222,6 @@ import devServer from './devServer.js'; | ||
catch (e) { | ||
console.error(e); | ||
r = () => { | ||
throw e; | ||
}; | ||
console.error(e); | ||
} | ||
@@ -291,2 +291,3 @@ const fnDefault = r.default || r; | ||
catch (e) { | ||
console.error(e); | ||
const error = parseStack(e.stack); | ||
@@ -293,0 +294,0 @@ const location = await SourceMapConsumer.with(sourcemap.text, null, (consumer) => { |
@@ -36,2 +36,40 @@ import { context, } from 'esbuild'; | ||
}; | ||
const resolvePlugin = { | ||
name: 'resolve-plugin', | ||
setup(build) { | ||
const resolved = {}; | ||
build.onResolve({ filter: /.*/, namespace: 'file' }, async ({ path, importer }) => { | ||
if (path === 'react' || | ||
path === 'react-dom' || | ||
path === '@based/react') { | ||
// now do it just for react | ||
if (!(path in resolved)) { | ||
try { | ||
resolved[path] = require.resolve(path, { | ||
paths: [importer], | ||
}); | ||
} | ||
catch (e) { | ||
resolved[path] = null; | ||
} | ||
} | ||
if (resolved[path]) { | ||
return { path: resolved[path] }; | ||
} | ||
} | ||
}); | ||
}, | ||
}; | ||
const defaultLoaders = { | ||
'.ico': 'file', | ||
'.eot': 'file', | ||
'.gif': 'file', | ||
'.jpeg': 'file', | ||
'.jpg': 'file', | ||
'.png': 'file', | ||
'.svg': 'file', | ||
'.ttf': 'file', | ||
'.woff': 'file', | ||
'.woff2': 'file', | ||
}; | ||
export const bundleApp = ({ publicPath, config: { main, favicon, loader, mainFields }, dir, cluster, watch, }, cb) => { | ||
@@ -56,12 +94,3 @@ const absolutePath = (path) => (isAbsolute(path) ? path : join(dir, path)); | ||
loader: { | ||
'.ico': 'file', | ||
'.eot': 'file', | ||
'.gif': 'file', | ||
'.jpeg': 'file', | ||
'.jpg': 'file', | ||
'.png': 'file', | ||
'.svg': 'file', | ||
'.ttf': 'file', | ||
'.woff': 'file', | ||
'.woff2': 'file', | ||
...defaultLoaders, | ||
...loader, | ||
@@ -71,28 +100,3 @@ }, | ||
plugins: [ | ||
{ | ||
name: 'my-plugin', | ||
setup(build) { | ||
const resolved = {}; | ||
build.onResolve({ filter: /.*/, namespace: 'file' }, async ({ path, importer }) => { | ||
if (path === 'react' || | ||
path === 'react-dom' || | ||
path === '@based/react') { | ||
// now do it just for react | ||
if (!(path in resolved)) { | ||
try { | ||
resolved[path] = require.resolve(path, { | ||
paths: [importer], | ||
}); | ||
} | ||
catch (e) { | ||
resolved[path] = null; | ||
} | ||
} | ||
if (resolved[path]) { | ||
return { path: resolved[path] }; | ||
} | ||
} | ||
}); | ||
}, | ||
}, | ||
resolvePlugin, | ||
polyfillNode({ | ||
@@ -131,4 +135,9 @@ globals: { | ||
...opts, | ||
loader: { | ||
...defaultLoaders, | ||
...opts.loader, | ||
}, | ||
plugins: [ | ||
...(opts.plugins || []), | ||
resolvePlugin, | ||
{ | ||
@@ -135,0 +144,0 @@ name: 'my-plugin', |
{ | ||
"name": "@based/cli", | ||
"version": "7.0.1", | ||
"version": "7.0.2-alpha.0", | ||
"description": "", | ||
@@ -37,5 +37,5 @@ "bin": "bin/cmd.js", | ||
"dependencies": { | ||
"@based/client": "5.3.0", | ||
"@based/client": "6.0.1", | ||
"@based/type-gen": "0.0.4", | ||
"@based/server": "7.1.0", | ||
"@based/server": "8.0.0", | ||
"esbuild-plugin-polyfill-node": "0.3.0", | ||
@@ -42,0 +42,0 @@ "@inquirer/confirm": "1.0.11", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
225703
3472
2
+ Added@based/client@6.0.1(transitive)
+ Added@based/server@8.0.0(transitive)
+ Added@saulx/utils@4.3.2(transitive)
- Removed@based/client@5.3.0(transitive)
- Removed@based/server@7.1.0(transitive)
Updated@based/client@6.0.1
Updated@based/server@8.0.0