@shopify/async
Advanced tools
Comparing version 2.2.3 to 2.2.4-graphql-config-beta.1
@@ -11,2 +11,3 @@ "use strict"; | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _types[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -24,2 +25,3 @@ enumerable: true, | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _resolver[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -26,0 +28,0 @@ enumerable: true, |
@@ -106,6 +106,3 @@ "use strict"; | ||
} | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
/* eslint-enable @typescript-eslint/camelcase */ | ||
// Webpack does not like seeing an explicit require(someVariable) in code | ||
@@ -130,13 +127,9 @@ // because that is a dynamic require that it can’t resolve. This code | ||
function tryRequire(id) { | ||
if ( | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
typeof __webpack_require__ === 'function' && (typeof __webpack_modules__ === "undefined" ? "undefined" : _typeof(__webpack_modules__)) === 'object' && __webpack_modules__[id] | ||
/* eslint-enable @typescript-eslint/camelcase */ | ||
) { | ||
try { | ||
return normalize(__webpack_require__(id)); | ||
} catch (_unused) {// Just ignore failures | ||
} | ||
} else if (typeof nodeRequire === 'function') { | ||
if (typeof __webpack_require__ === 'function' && (typeof __webpack_modules__ === "undefined" ? "undefined" : _typeof(__webpack_modules__)) === 'object' && __webpack_modules__[id]) { | ||
try { | ||
return normalize(__webpack_require__(id)); | ||
} catch (_unused) {// Just ignore failures | ||
} | ||
} else if (typeof nodeRequire === 'function') { | ||
try { | ||
return normalize(nodeRequire(id)); | ||
@@ -143,0 +136,0 @@ } catch (_unused2) {// Just ignore failures |
@@ -11,2 +11,3 @@ "use strict"; | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _types[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -24,2 +25,3 @@ enumerable: true, | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _resolver[key]) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -26,0 +28,0 @@ enumerable: true, |
@@ -51,6 +51,3 @@ "use strict"; | ||
} | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
/* eslint-enable @typescript-eslint/camelcase */ | ||
// Webpack does not like seeing an explicit require(someVariable) in code | ||
@@ -75,13 +72,9 @@ // because that is a dynamic require that it can’t resolve. This code | ||
function tryRequire(id) { | ||
if ( | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
typeof __webpack_require__ === 'function' && typeof __webpack_modules__ === 'object' && __webpack_modules__[id] | ||
/* eslint-enable @typescript-eslint/camelcase */ | ||
) { | ||
try { | ||
return normalize(__webpack_require__(id)); | ||
} catch {// Just ignore failures | ||
} | ||
} else if (typeof nodeRequire === 'function') { | ||
if (typeof __webpack_require__ === 'function' && typeof __webpack_modules__ === 'object' && __webpack_modules__[id]) { | ||
try { | ||
return normalize(__webpack_require__(id)); | ||
} catch {// Just ignore failures | ||
} | ||
} else if (typeof nodeRequire === 'function') { | ||
try { | ||
return normalize(nodeRequire(id)); | ||
@@ -88,0 +81,0 @@ } catch {// Just ignore failures |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var DEFAULT_PACKAGES_TO_PROCESS = { | ||
const DEFAULT_PACKAGES_TO_PROCESS = { | ||
'@shopify/alpaql/async': ['createAsyncQuery'], | ||
@@ -10,27 +7,23 @@ '@shopify/async': ['createResolver'], | ||
}; | ||
function asyncBabelPlugin(_a) { | ||
var t = _a.types; | ||
export default function asyncBabelPlugin({ types: t }) { | ||
return { | ||
visitor: { | ||
Program: function (_path, state) { | ||
Program(_path, state) { | ||
state.processPackages = new Map(Object.entries((state.opts && state.opts.packages) || DEFAULT_PACKAGES_TO_PROCESS)); | ||
}, | ||
ImportDeclaration: function (path, state) { | ||
var e_1, _a; | ||
var processPackages = state.processPackages; | ||
ImportDeclaration(path, state) { | ||
const { processPackages } = state; | ||
if (!(processPackages instanceof Map)) { | ||
return; | ||
} | ||
var source = path.node.source.value; | ||
var processImports = processPackages.get(source) || []; | ||
const source = path.node.source.value; | ||
const processImports = processPackages.get(source) || []; | ||
if (processImports.length === 0) { | ||
return; | ||
} | ||
var importSpecifiersToProcess = path | ||
const importSpecifiersToProcess = path | ||
.get('specifiers') | ||
.filter(function (specifier) { | ||
.filter(specifier => { | ||
return (specifier.isImportSpecifier() && | ||
processImports.some(function (name) { | ||
return specifier.get('imported').isIdentifier({ name: name }); | ||
})); | ||
processImports.some(name => specifier.get('imported').isIdentifier({ name }))); | ||
}); | ||
@@ -40,19 +33,9 @@ if (importSpecifiersToProcess.length === 0) { | ||
} | ||
try { | ||
for (var importSpecifiersToProcess_1 = tslib_1.__values(importSpecifiersToProcess), importSpecifiersToProcess_1_1 = importSpecifiersToProcess_1.next(); !importSpecifiersToProcess_1_1.done; importSpecifiersToProcess_1_1 = importSpecifiersToProcess_1.next()) { | ||
var importSpecifier = importSpecifiersToProcess_1_1.value; | ||
var bindingName = importSpecifier.node.local.name; | ||
var binding = path.scope.getBinding(bindingName); | ||
if (binding != null) { | ||
addIdOption(binding, t, state.opts); | ||
} | ||
for (const importSpecifier of importSpecifiersToProcess) { | ||
const bindingName = importSpecifier.node.local.name; | ||
const binding = path.scope.getBinding(bindingName); | ||
if (binding != null) { | ||
addIdOption(binding, t, state.opts); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (importSpecifiersToProcess_1_1 && !importSpecifiersToProcess_1_1.done && (_a = importSpecifiersToProcess_1.return)) _a.call(importSpecifiersToProcess_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
}, | ||
@@ -62,25 +45,23 @@ }, | ||
} | ||
exports.default = asyncBabelPlugin; | ||
function addIdOption(binding, t, _a) { | ||
var _b = (_a === void 0 ? {} : _a).webpack, webpack = _b === void 0 ? true : _b; | ||
binding.referencePaths.forEach(function (refPath) { | ||
var callExpression = refPath.parentPath; | ||
function addIdOption(binding, t, { webpack = true } = {}) { | ||
binding.referencePaths.forEach(refPath => { | ||
const callExpression = refPath.parentPath; | ||
if (!callExpression.isCallExpression()) { | ||
return; | ||
} | ||
var args = callExpression.get('arguments'); | ||
const args = callExpression.get('arguments'); | ||
if (args.length === 0) { | ||
return; | ||
} | ||
var options = args[0]; | ||
const options = args[0]; | ||
if (!options.isObjectExpression()) { | ||
return; | ||
} | ||
var properties = options.get('properties'); | ||
var propertiesMap = {}; | ||
properties.forEach(function (property) { | ||
const properties = options.get('properties'); | ||
const propertiesMap = {}; | ||
properties.forEach(property => { | ||
if (!property.isObjectMember() || property.node.computed) { | ||
return; | ||
} | ||
var key = property.get('key'); | ||
const key = property.get('key'); | ||
if (!key.isIdentifier()) { | ||
@@ -91,14 +72,13 @@ return; | ||
}); | ||
var id = propertiesMap.id, loadProperty = propertiesMap.load; | ||
const { id, load: loadProperty } = propertiesMap; | ||
if (id != null || loadProperty == null) { | ||
return; | ||
} | ||
var loaderMethod = loadProperty.isObjectProperty() | ||
const loaderMethod = loadProperty.isObjectProperty() | ||
? loadProperty.get('value') | ||
: loadProperty.get('body'); | ||
var dynamicImports = []; | ||
const dynamicImports = []; | ||
if (!Array.isArray(loaderMethod)) { | ||
loaderMethod.traverse({ | ||
Import: function (_a) { | ||
var parentPath = _a.parentPath; | ||
Import({ parentPath }) { | ||
if (parentPath.isCallExpression()) { | ||
@@ -105,0 +85,0 @@ dynamicImports.push(parentPath); |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./types"), exports); | ||
tslib_1.__exportStar(require("./resolver"), exports); | ||
export * from './types'; | ||
export * from './resolver'; |
@@ -1,12 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createResolver = void 0; | ||
var tslib_1 = require("tslib"); | ||
function createResolver(_a) { | ||
var _this = this; | ||
var id = _a.id, load = _a.load; | ||
var resolved = null; | ||
var resolvePromise = null; | ||
var hasTriedSyncResolve = false; | ||
var resolvedId = id && id(); | ||
export function createResolver({ id, load }) { | ||
let resolved = null; | ||
let resolvePromise = null; | ||
let hasTriedSyncResolve = false; | ||
const resolvedId = id && id(); | ||
return { | ||
@@ -23,29 +17,12 @@ get id() { | ||
}, | ||
resolve: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
resolvePromise = resolvePromise || resolve(load); | ||
return [4 /*yield*/, resolvePromise]; | ||
case 1: | ||
resolved = _a.sent(); | ||
return [2 /*return*/, resolved]; | ||
} | ||
}); | ||
}); }, | ||
resolve: async () => { | ||
resolvePromise = resolvePromise || resolve(load); | ||
resolved = await resolvePromise; | ||
return resolved; | ||
}, | ||
}; | ||
} | ||
exports.createResolver = createResolver; | ||
function resolve(load) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var resolved; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, load()]; | ||
case 1: | ||
resolved = _a.sent(); | ||
return [2 /*return*/, normalize(resolved)]; | ||
} | ||
}); | ||
}); | ||
async function resolve(load) { | ||
const resolved = await load(); | ||
return normalize(resolved); | ||
} | ||
@@ -56,6 +33,5 @@ function normalize(module) { | ||
} | ||
var value = typeof module === 'object' && 'default' in module ? module.default : module; | ||
const value = typeof module === 'object' && 'default' in module ? module.default : module; | ||
return value == null ? null : value; | ||
} | ||
/* eslint-enable @typescript-eslint/camelcase */ | ||
// Webpack does not like seeing an explicit require(someVariable) in code | ||
@@ -73,4 +49,4 @@ // because that is a dynamic require that it can’t resolve. This code | ||
// the global require function. | ||
var requireKey = 'require'; | ||
var nodeRequire = (typeof global === 'object' && | ||
const requireKey = 'require'; | ||
const nodeRequire = (typeof global === 'object' && | ||
typeof global[requireKey] === 'function' && | ||
@@ -87,9 +63,5 @@ global[requireKey]) || | ||
function tryRequire(id) { | ||
if ( | ||
/* eslint-disable @typescript-eslint/camelcase */ | ||
typeof __webpack_require__ === 'function' && | ||
if (typeof __webpack_require__ === 'function' && | ||
typeof __webpack_modules__ === 'object' && | ||
__webpack_modules__[id] | ||
/* eslint-enable @typescript-eslint/camelcase */ | ||
) { | ||
__webpack_modules__[id]) { | ||
try { | ||
@@ -96,0 +68,0 @@ return normalize(__webpack_require__(id)); |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DeferTiming = void 0; | ||
var DeferTiming; | ||
export var DeferTiming; | ||
(function (DeferTiming) { | ||
@@ -9,2 +6,2 @@ DeferTiming[DeferTiming["Mount"] = 0] = "Mount"; | ||
DeferTiming[DeferTiming["InViewport"] = 2] = "InViewport"; | ||
})(DeferTiming = exports.DeferTiming || (exports.DeferTiming = {})); | ||
})(DeferTiming || (DeferTiming = {})); |
@@ -8,4 +8,12 @@ # Changelog | ||
## [2.2.2] - 2021-03-03 | ||
<!-- ## Unreleased --> | ||
## 2.2.4 - 2021-04-13 | ||
### Changed | ||
- Removed dependency on tslib, as we no-longer compile with `tsc`. [#1829](https://github.com/Shopify/quilt/pull/1829) | ||
## 2.2.2 - 2021-03-03 | ||
### Fixed | ||
@@ -15,3 +23,3 @@ | ||
## [2.2.0] - 2020-12-18 | ||
## 2.2.0 - 2020-12-18 | ||
@@ -22,3 +30,3 @@ ### Added | ||
## [2.1.7] - 2020-12-11 | ||
## 2.1.7 - 2020-12-11 | ||
@@ -29,7 +37,7 @@ ### Added | ||
## [2.1.6] - 2020-10-20 | ||
## 2.1.6 - 2020-10-20 | ||
- Added `tslib@^1.14.1` in the list of dependencies. [#1657](https://github.com/Shopify/quilt/pull/1657) | ||
## [2.1.0] - 2019-10-30 | ||
## 2.1.0 - 2019-10-30 | ||
@@ -44,3 +52,3 @@ ### Added | ||
## [2.0.0] - 2019-07-03 | ||
## 2.0.0 - 2019-07-03 | ||
@@ -51,3 +59,3 @@ ### Added | ||
## [1.3.0] - 2019-03-25 | ||
## 1.3.0 - 2019-03-25 | ||
@@ -58,3 +66,3 @@ ### Added | ||
## [1.2.0] - 2019-03-11 | ||
## 1.2.0 - 2019-03-11 | ||
@@ -65,3 +73,3 @@ ### Added | ||
## [1.1.0] - 2019-02-25 | ||
## 1.1.0 - 2019-02-25 | ||
@@ -68,0 +76,0 @@ ### Added |
{ | ||
"name": "@shopify/async", | ||
"version": "2.2.3", | ||
"version": "2.2.4-graphql-config-beta.1", | ||
"license": "MIT", | ||
@@ -8,5 +8,2 @@ "description": "Primitives for loading parts of an application asynchronously", | ||
"types": "index.d.ts", | ||
"scripts": { | ||
"build": "tsc --p tsconfig.json" | ||
}, | ||
"sideEffects": false, | ||
@@ -63,6 +60,3 @@ "publishConfig": { | ||
} | ||
}, | ||
"dependencies": { | ||
"tslib": "^1.14.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
57835
1006
1
- Removedtslib@^1.14.1
- Removedtslib@1.14.1(transitive)