@umijs/core 4.0.0-rc.1 → 4.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(){var e={958:function(e,n,r){const t=r(747);const o=r(622);const s=r(87);function log(e){console.log(`[dotenv][DEBUG] ${e}`)}const i="\n";const c=/^\s*([\w.-]+)\s*=\s*(.*)?\s*$/;const u=/\\n/g;const l=/\r\n|\n|\r/;function parse(e,n){const r=Boolean(n&&n.debug);const t={};e.toString().split(l).forEach((function(e,n){const o=e.match(c);if(o!=null){const e=o[1];let n=o[2]||"";const r=n.length-1;const s=n[0]==='"'&&n[r]==='"';const c=n[0]==="'"&&n[r]==="'";if(c||s){n=n.substring(1,r);if(s){n=n.replace(u,i)}}else{n=n.trim()}t[e]=n}else if(r){log(`did not match key and value when parsing line ${n+1}: ${e}`)}}));return t}function resolveHome(e){return e[0]==="~"?o.join(s.homedir(),e.slice(1)):e}function config(e){let n=o.resolve(process.cwd(),".env");let r="utf8";let s=false;if(e){if(e.path!=null){n=resolveHome(e.path)}if(e.encoding!=null){r=e.encoding}if(e.debug!=null){s=true}}try{const e=parse(t.readFileSync(n,{encoding:r}),{debug:s});Object.keys(e).forEach((function(n){if(!Object.prototype.hasOwnProperty.call(process.env,n)){process.env[n]=e[n]}else if(s){log(`"${n}" is already defined in \`process.env\` and will not be overwritten`)}}));return{parsed:e}}catch(e){return{error:e}}}e.exports.config=config;e.exports.parse=parse},747:function(e){"use strict";e.exports=require("fs")},87:function(e){"use strict";e.exports=require("os")},622:function(e){"use strict";e.exports=require("path")}};var n={};function __nccwpck_require__(r){var t=n[r];if(t!==undefined){return t.exports}var o=n[r]={exports:{}};var s=true;try{e[r](o,o.exports,__nccwpck_require__);s=false}finally{if(s)delete n[r]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(958);module.exports=r})();
1
+ (function(){var e={875:function(e,r,n){const o=n(147);const t=n(17);const s=n(37);const i=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function parse(e){const r={};let n=e.toString();n=n.replace(/\r\n?/gm,"\n");let o;while((o=i.exec(n))!=null){const e=o[1];let n=o[2]||"";n=n.trim();const t=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/gm,"$2");if(t==='"'){n=n.replace(/\\n/g,"\n");n=n.replace(/\\r/g,"\r")}r[e]=n}return r}function _log(e){console.log(`[dotenv][DEBUG] ${e}`)}function _resolveHome(e){return e[0]==="~"?t.join(s.homedir(),e.slice(1)):e}function config(e){let r=t.resolve(process.cwd(),".env");let n="utf8";const s=Boolean(e&&e.debug);const i=Boolean(e&&e.override);if(e){if(e.path!=null){r=_resolveHome(e.path)}if(e.encoding!=null){n=e.encoding}}try{const e=c.parse(o.readFileSync(r,{encoding:n}));Object.keys(e).forEach((function(r){if(!Object.prototype.hasOwnProperty.call(process.env,r)){process.env[r]=e[r]}else{if(i===true){process.env[r]=e[r]}if(s){if(i===true){_log(`"${r}" is already defined in \`process.env\` and WAS overwritten`)}else{_log(`"${r}" is already defined in \`process.env\` and was NOT overwritten`)}}}}));return{parsed:e}}catch(e){if(s){_log(`Failed to load ${r} ${e.message}`)}return{error:e}}}const c={config:config,parse:parse};e.exports.config=c.config;e.exports.parse=c.parse;e.exports=c},147:function(e){"use strict";e.exports=require("fs")},37:function(e){"use strict";e.exports=require("os")},17:function(e){"use strict";e.exports=require("path")}};var r={};function __nccwpck_require__(n){var o=r[n];if(o!==undefined){return o.exports}var t=r[n]={exports:{}};var s=true;try{e[n](t,t.exports,__nccwpck_require__);s=false}finally{if(s)delete r[n]}return t.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(875);module.exports=n})();
@@ -0,0 +1,73 @@
1
+ // TypeScript Version: 3.0
2
+ /// <reference types="node" />
3
+
4
+ export interface DotenvParseOutput {
5
+ [name: string]: string;
6
+ }
7
+
8
+ /**
9
+ * Parses a string or buffer in the .env file format into an object.
10
+ *
11
+ * See https://docs.dotenv.org
12
+ *
13
+ * @param src - contents to be parsed. example: `'DB_HOST=localhost'`
14
+ * @param options - additional options. example: `{ debug: true }`
15
+ * @returns an object with keys and values based on `src`. example: `{ DB_HOST : 'localhost' }`
16
+ */
17
+ export function parse<T extends DotenvParseOutput = DotenvParseOutput>(
18
+ src: string | Buffer
19
+ ): T;
20
+
21
+ export interface DotenvConfigOptions {
22
+ /**
23
+ * Default: `path.resolve(process.cwd(), '.env')`
24
+ *
25
+ * Specify a custom path if your file containing environment variables is located elsewhere.
26
+ *
27
+ * example: `require('dotenv').config({ path: '/custom/path/to/.env' })`
28
+ */
29
+ path?: string;
30
+
31
+ /**
32
+ * Default: `utf8`
33
+ *
34
+ * Specify the encoding of your file containing environment variables.
35
+ *
36
+ * example: `require('dotenv').config({ encoding: 'latin1' })`
37
+ */
38
+ encoding?: string;
39
+
40
+ /**
41
+ * Default: `false`
42
+ *
43
+ * Turn on logging to help debug why certain keys or values are not being set as you expect.
44
+ *
45
+ * example: `require('dotenv').config({ debug: process.env.DEBUG })`
46
+ */
47
+ debug?: boolean;
48
+
49
+ /**
50
+ * Default: `false`
51
+ *
52
+ * Override any environment variables that have already been set on your machine with values from your .env file.
53
+ *
54
+ * example: `require('dotenv').config({ override: true })`
55
+ */
56
+ override?: boolean;
57
+ }
58
+
59
+ export interface DotenvConfigOutput {
60
+ error?: Error;
61
+ parsed?: DotenvParseOutput;
62
+ }
63
+
64
+ /**
65
+ * Loads `.env` file contents into process.env.
66
+ *
67
+ * See https://docs.dotenv.org
68
+ *
69
+ * @param options - additional options. example: `{ path: './custom/path', encoding: 'latin1', debug: true, override: false }`
70
+ * @returns an object with a `parsed` key if successful or `error` key if an error occurred. example: { parsed: { KEY: 'value' } }
71
+ *
72
+ */
73
+ export function config(options?: DotenvConfigOptions): DotenvConfigOutput;
@@ -1 +1 @@
1
- {"name":"dotenv","license":"BSD-2-Clause","types":"types/index.d.ts"}
1
+ {"name":"dotenv","license":"BSD-2-Clause","types":"lib/main.d.ts"}
@@ -1 +1 @@
1
- (function(){var e={784:function(e){e.exports={diff:diff,jsonPatchPathConverter:jsonPatchPathConverter};function diff(e,r,t){if(!e||typeof e!="object"||!r||typeof r!="object"){throw new Error("both arguments must be objects or arrays")}t||(t=function(e){return e});function getDiff(e,r,a,n){var o=Object.keys(e);var c=o.length;var i=Object.keys(r);var f=i.length;var u;for(var p=0;p<c;p++){var s=Array.isArray(e)?Number(o[p]):o[p];if(!(s in r)){u=a.concat(s);n.remove.push({op:"remove",path:t(u)})}}for(var p=0;p<f;p++){var s=Array.isArray(r)?Number(i[p]):i[p];var v=e[s];var _=r[s];if(!(s in e)){u=a.concat(s);var h=r[s];n.add.push({op:"add",path:t(u),value:h})}else if(v!==_){if(Object(v)!==v||Object(_)!==_){u=pushReplace(u,a,s,n,t,r)}else{if(!Object.keys(v).length&&!Object.keys(_).length&&String(v)!=String(_)){u=pushReplace(u,a,s,n,t,r)}else{getDiff(e[s],r[s],a.concat(s),n)}}}}return n.remove.reverse().concat(n.replace).concat(n.add)}return getDiff(e,r,[],{remove:[],replace:[],add:[]})}function pushReplace(e,r,t,a,n,o){e=r.concat(t);a.replace.push({op:"replace",path:n(e),value:o[t]});return e}function jsonPatchPathConverter(e){return[""].concat(e).join("/")}}};var r={};function __nccwpck_require__(t){var a=r[t];if(a!==undefined){return a.exports}var n=r[t]={exports:{}};var o=true;try{e[t](n,n.exports,__nccwpck_require__);o=false}finally{if(o)delete r[t]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(784);module.exports=t})();
1
+ (function(){var e={277:function(e){e.exports={diff:diff,jsonPatchPathConverter:jsonPatchPathConverter};function diff(e,r,t){if(!e||typeof e!="object"||!r||typeof r!="object"){throw new Error("both arguments must be objects or arrays")}t||(t=function(e){return e});function getDiff(e,r,a,n){var o=Object.keys(e);var c=o.length;var i=Object.keys(r);var f=i.length;var u;for(var p=0;p<c;p++){var s=Array.isArray(e)?Number(o[p]):o[p];if(!(s in r)){u=a.concat(s);n.remove.push({op:"remove",path:t(u)})}}for(var p=0;p<f;p++){var s=Array.isArray(r)?Number(i[p]):i[p];var v=e[s];var _=r[s];if(!(s in e)){u=a.concat(s);var h=r[s];n.add.push({op:"add",path:t(u),value:h})}else if(v!==_){if(Object(v)!==v||Object(_)!==_){u=pushReplace(u,a,s,n,t,r)}else{if(!Object.keys(v).length&&!Object.keys(_).length&&String(v)!=String(_)){u=pushReplace(u,a,s,n,t,r)}else{getDiff(e[s],r[s],a.concat(s),n)}}}}return n.remove.reverse().concat(n.replace).concat(n.add)}return getDiff(e,r,[],{remove:[],replace:[],add:[]})}function pushReplace(e,r,t,a,n,o){e=r.concat(t);a.replace.push({op:"replace",path:n(e),value:o[t]});return e}function jsonPatchPathConverter(e){return[""].concat(e).join("/")}}};var r={};function __nccwpck_require__(t){var a=r[t];if(a!==undefined){return a.exports}var n=r[t]={exports:{}};var o=true;try{e[t](n,n.exports,__nccwpck_require__);o=false}finally{if(o)delete r[t]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t=__nccwpck_require__(277);module.exports=t})();
@@ -25,7 +25,7 @@ class Plugin {
25
25
  let pkg = null;
26
26
  // path is the package entry
27
27
  let isPkgEntry = false;
28
- const pkgJSONPath = utils_1.pkgUp.sync({ cwd: this.path });
28
+ const pkgJSONPath = utils_1.pkgUp.pkgUpSync({ cwd: this.path });
29
29
  if (pkgJSONPath) {
30
30
  pkg = require(pkgJSONPath);
31
31
  isPkgEntry =
@@ -20,6 +20,7 @@ export declare class Service {
20
20
  version: string;
21
21
  matches: string[];
22
22
  subpaths: string[];
23
+ external?: boolean;
23
24
  }>;
24
25
  [key: string]: any;
25
26
  };
@@ -207,9 +207,6 @@ class Service {
207
207
  env: this.env,
208
208
  prefix: this.opts.frameworkName || constants_1.DEFAULT_FRAMEWORK_NAME,
209
209
  });
210
- if (this.config.outputPath) {
211
- paths.absOutputPath = (0, path_1.join)(this.cwd, this.config.outputPath);
212
- }
213
210
  this.stage = types_1.ServiceStage.resolveConfig;
214
211
  const config = yield this.applyPlugins({
215
212
  key: 'modifyConfig',
@@ -226,6 +223,9 @@ class Service {
226
223
  initialValue: this.configDefaults,
227
224
  });
228
225
  this.config = utils_1.lodash.merge(defaultConfig, config);
226
+ if (this.config.outputPath) {
227
+ paths.absOutputPath = (0, path_1.join)(this.cwd, this.config.outputPath);
228
+ }
229
229
  this.paths = yield this.applyPlugins({
230
230
  key: 'modifyPaths',
231
231
  initialValue: paths,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/core",
3
- "version": "4.0.0-rc.1",
3
+ "version": "4.0.0-rc.2",
4
4
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/core#readme",
5
5
  "bugs": "https://github.com/umijs/umi-next/issues",
6
6
  "repository": {
@@ -20,14 +20,14 @@
20
20
  "dev": "pnpm build -- --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@umijs/bundler-utils": "4.0.0-rc.1",
24
- "@umijs/utils": "4.0.0-rc.1"
23
+ "@umijs/bundler-utils": "4.0.0-rc.2",
24
+ "@umijs/utils": "4.0.0-rc.2"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@hapi/joi": "17.1.1",
28
- "@types/hapi__joi": "17.1.7",
29
- "dotenv": "10.0.0",
30
- "just-diff": "3.1.1",
28
+ "@types/hapi__joi": "17.1.8",
29
+ "dotenv": "16.0.0",
30
+ "just-diff": "5.0.1",
31
31
  "tapable": "2.2.1"
32
32
  },
33
33
  "publishConfig": {