@percy/env 1.26.2-beta.0 → 1.26.3-alpha.4

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.
package/dist/dotenv.js CHANGED
@@ -45,7 +45,8 @@ export function load() {
45
45
  for (let {
46
46
  groups: match
47
47
  } of src.matchAll(LINE_REG)) {
48
- let value = match.sval ?? match.dval ?? match.uval ?? '';
48
+ var _ref, _ref2, _match$sval;
49
+ let value = (_ref = (_ref2 = (_match$sval = match.sval) !== null && _match$sval !== void 0 ? _match$sval : match.dval) !== null && _ref2 !== void 0 ? _ref2 : match.uval) !== null && _ref !== void 0 ? _ref : '';
49
50
 
50
51
  // if double quoted, expand newlines
51
52
  if (match.dquote) {
@@ -58,8 +59,9 @@ export function load() {
58
59
  // if not single quoted, interpolate substitutions
59
60
  if (!match.squote) {
60
61
  value = value.replace(INTERPOLATE_REG, (_, pre, ref, key) => {
62
+ var _process$env$key;
61
63
  if (pre === '\\') return ref; // escaped reference
62
- return pre + (process.env[key] ?? '');
64
+ return pre + ((_process$env$key = process.env[key]) !== null && _process$env$key !== void 0 ? _process$env$key : '');
63
65
  });
64
66
  }
65
67
 
@@ -1,3 +1,6 @@
1
+ const _excluded = ["get"];
2
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1
4
  import { getCommitData, getJenkinsSha, github } from './utils.js';
2
5
  import logger from '@percy/logger';
3
6
  export class PercyEnv {
@@ -68,8 +71,7 @@ export class PercyEnv {
68
71
  if (this.vars.PERCY_COMMIT) {
69
72
  return this.vars.PERCY_COMMIT;
70
73
  }
71
- let commit = (() => {
72
- var _github$pull_request;
74
+ let commit = (_github$pull_request => {
73
75
  switch (this.ci) {
74
76
  case 'travis':
75
77
  return this.vars.TRAVIS_COMMIT;
@@ -114,8 +116,7 @@ export class PercyEnv {
114
116
  if (this.vars.PERCY_BRANCH) {
115
117
  return this.vars.PERCY_BRANCH;
116
118
  }
117
- let branch = (() => {
118
- var _github$pull_request2;
119
+ let branch = (_github$pull_request2 => {
119
120
  switch (this.ci) {
120
121
  case 'travis':
121
122
  return this.pullRequest && this.vars.TRAVIS_PULL_REQUEST_BRANCH || this.vars.TRAVIS_BRANCH;
@@ -161,8 +162,7 @@ export class PercyEnv {
161
162
  if (this.vars.PERCY_PULL_REQUEST) {
162
163
  return this.vars.PERCY_PULL_REQUEST;
163
164
  }
164
- let pr = (() => {
165
- var _this$vars$CI_PULL_RE, _this$vars$PULL_REQUE, _github$pull_request3, _this$vars$DRONE_COMM;
165
+ let pr = ((_this$vars$CI_PULL_RE, _this$vars$PULL_REQUE, _github$pull_request3, _this$vars$DRONE_COMM) => {
166
166
  switch (this.ci) {
167
167
  case 'travis':
168
168
  return this.vars.TRAVIS_PULL_REQUEST !== 'false' && this.vars.TRAVIS_PULL_REQUEST;
@@ -207,8 +207,7 @@ export class PercyEnv {
207
207
  if (!Number.isInteger(total)) total = null;
208
208
 
209
209
  // no nonce if no total
210
- let nonce = total && (() => {
211
- var _this$vars$BUILD_TAG;
210
+ let nonce = total && (_this$vars$BUILD_TAG => {
212
211
  if (this.vars.PERCY_PARALLEL_NONCE) {
213
212
  return this.vars.PERCY_PARALLEL_NONCE;
214
213
  }
@@ -279,21 +278,24 @@ export class PercyEnv {
279
278
  }
280
279
 
281
280
  // cache getters on initial call so subsequent calls are not re-computed
282
- Object.defineProperties(PercyEnv.prototype, Object.entries(Object.getOwnPropertyDescriptors(PercyEnv.prototype)).reduce((proto, [key, {
283
- get,
284
- ...descr
285
- }]) => !get ? proto : Object.assign(proto, {
286
- [key]: Object.assign(descr, {
287
- get() {
288
- let value = get.call(this);
289
- Object.defineProperty(this, key, {
290
- value
291
- });
292
- if (key !== 'token') {
293
- this.log.debug(`Detected ${key} as ${JSON.stringify(value)}`);
281
+ Object.defineProperties(PercyEnv.prototype, Object.entries(Object.getOwnPropertyDescriptors(PercyEnv.prototype)).reduce((proto, [key, _ref]) => {
282
+ let {
283
+ get
284
+ } = _ref,
285
+ descr = _objectWithoutProperties(_ref, _excluded);
286
+ return !get ? proto : Object.assign(proto, {
287
+ [key]: Object.assign(descr, {
288
+ get() {
289
+ let value = get.call(this);
290
+ Object.defineProperty(this, key, {
291
+ value
292
+ });
293
+ if (key !== 'token') {
294
+ this.log.debug(`Detected ${key} as ${JSON.stringify(value)}`);
295
+ }
296
+ return value;
294
297
  }
295
- return value;
296
- }
297
- })
298
- }), {}));
298
+ })
299
+ });
300
+ }, {}));
299
301
  export default PercyEnv;
package/dist/utils.js CHANGED
@@ -52,4 +52,16 @@ export function github({
52
52
  } catch {}
53
53
  }
54
54
  return github.payload || (github.payload = {});
55
+ }
56
+
57
+ // auto strip double quotes/spaces if any
58
+ export function stripQuotesAndSpaces(line) {
59
+ if (typeof line === 'string') {
60
+ const regex = /^["\s"]+|["\s"]+$/g;
61
+ const strippedLine = line.replace(regex, '');
62
+ return strippedLine;
63
+ } else {
64
+ return null;
65
+ }
66
+ ;
55
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/env",
3
- "version": "1.26.2-beta.0",
3
+ "version": "1.26.3-alpha.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "beta"
12
+ "tag": "alpha"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -32,7 +32,7 @@
32
32
  "test:coverage": "yarn test --coverage"
33
33
  },
34
34
  "dependencies": {
35
- "@percy/logger": "1.26.2-beta.0"
35
+ "@percy/logger": "1.26.3-alpha.4"
36
36
  },
37
- "gitHead": "14191aa65d5da5190039ae0938c9fd8edab7cd28"
37
+ "gitHead": "d89ab97b8d5169eafd3eb42bdbbef41a2ac624ba"
38
38
  }