@sanity/export 2.36.2-weighted-search.10 → 2.36.2-weighted-search.16
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/lib/AssetHandler.js +6 -4
- package/package.json +2 -2
package/lib/AssetHandler.js
CHANGED
|
@@ -37,6 +37,8 @@ var ASSET_DOWNLOAD_CONCURRENCY = 8;
|
|
|
37
37
|
class AssetHandler {
|
|
38
38
|
constructor(options) {
|
|
39
39
|
var _this = this;
|
|
40
|
+
// Called when we want to download all assets to local filesystem and rewrite documents to hold
|
|
41
|
+
// placeholder asset references (_sanityAsset: 'image@file:///local/path')
|
|
40
42
|
_defineProperty(this, "rewriteAssets", miss.through.obj( /*#__PURE__*/function () {
|
|
41
43
|
var _ref = _asyncToGenerator(function* (doc, enc, callback) {
|
|
42
44
|
if (['sanity.imageAsset', 'sanity.fileAsset'].includes(doc._type)) {
|
|
@@ -53,6 +55,8 @@ class AssetHandler {
|
|
|
53
55
|
return _ref.apply(this, arguments);
|
|
54
56
|
};
|
|
55
57
|
}()));
|
|
58
|
+
// Called in the case where we don't _want_ assets, so basically just remove all asset documents
|
|
59
|
+
// as well as references to assets (*.asset._ref ^= (image|file)-)
|
|
56
60
|
_defineProperty(this, "stripAssets", miss.through.obj( /*#__PURE__*/function () {
|
|
57
61
|
var _ref2 = _asyncToGenerator(function* (doc, enc, callback) {
|
|
58
62
|
if (['sanity.imageAsset', 'sanity.fileAsset'].includes(doc._type)) {
|
|
@@ -65,6 +69,8 @@ class AssetHandler {
|
|
|
65
69
|
return _ref2.apply(this, arguments);
|
|
66
70
|
};
|
|
67
71
|
}()));
|
|
72
|
+
// Called when we are using raw export mode along with `assets: false`, where we simply
|
|
73
|
+
// want to skip asset documents but retain asset references (useful for data mangling)
|
|
68
74
|
_defineProperty(this, "skipAssets", miss.through.obj((doc, enc, callback) => {
|
|
69
75
|
var isAsset = ['sanity.imageAsset', 'sanity.fileAsset'].includes(doc._type);
|
|
70
76
|
if (isAsset) {
|
|
@@ -141,10 +147,6 @@ class AssetHandler {
|
|
|
141
147
|
this.queue.onIdle().then(() => resolve(this.assetMap));
|
|
142
148
|
});
|
|
143
149
|
}
|
|
144
|
-
|
|
145
|
-
// Called when we want to download all assets to local filesystem and rewrite documents to hold
|
|
146
|
-
// placeholder asset references (_sanityAsset: 'image@file:///local/path')
|
|
147
|
-
|
|
148
150
|
queueAssetDownload(assetDoc, dstPath, type) {
|
|
149
151
|
if (!assetDoc.url) {
|
|
150
152
|
debug('Asset document "%s" does not have a URL property, skipping', assetDoc._id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/export",
|
|
3
|
-
"version": "2.36.2-weighted-search.
|
|
3
|
+
"version": "2.36.2-weighted-search.16+eff44729a",
|
|
4
4
|
"description": "Export Sanity documents and assets",
|
|
5
5
|
"main": "lib/export.js",
|
|
6
6
|
"engines": {
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"url": "https://github.com/sanity-io/sanity/issues"
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://www.sanity.io/",
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "eff44729a407978a198b079169a4058e23fa7d5a"
|
|
53
53
|
}
|