prismic-helpers
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("PrismicHelpers",[],t):"object"==typeof exports?exports.PrismicHelpers=t():e.PrismicHelpers=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var u=n[r]={i:r,l:!1,exports:{}};return e[r].call(u.exports,u,u.exports,t),u.l=!0,u.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var u=n(2),o=r(u),i=n(1),f=r(i);e.exports={Link:o.default,Date:f.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(!e)return null;var t=24==e.length?e.substring(0,22)+":"+e.substring(22,24):e;return new Date(t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={url:function(e,t){return"Document"===e.link_type?t?t(e,e.isBroken):"":e.url}}},function(e,t,n){e.exports=n(0)}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("PrismicHelpers",[],t):"object"==typeof exports?exports.PrismicHelpers=t():e.PrismicHelpers=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";t.a={url:function(e,t){if(e&&[e.link_type,e._linkType,e.linkType].some((function(e){return e&&["Document","Link.Document","Link.document"].includes(e)}))&&t&&"function"==typeof t){var n=t(e);if(n)return n}return e&&e.url?e.url:""}}},function(e,t,n){"use strict";t.a=function(e){if(!e)return null;var t=24==e.length?"".concat(e.substring(0,22),":").concat(e.substring(22,24)):e;return new Date(t)}},function(e,t,n){e.exports=n(3)},function(e,t,n){"use strict";n.r(t),function(e){var t=n(0),r=n(1);e.exports={Link:t.a,Date:r.a}}.call(this,n(4)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}}])})); |
{ | ||
"name": "prismic-helpers", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Set of helpers to manage prismic data from api v2", | ||
"main": "dist/prismic-helpers.min.js", | ||
"scripts": { | ||
"build": "webpack --debug; webpack -p", | ||
"dev": "webpack -d --watch", | ||
"build": "node node_modules/webpack --debug & webpack -p", | ||
"dev": "node node_modules/webpack -d --watch", | ||
"prepublish": "npm run build" | ||
@@ -22,9 +22,9 @@ }, | ||
"devDependencies": { | ||
"babel-core": "^6.25.0", | ||
"babel-loader": "^7.1.1", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"webpack": "^2.7.0", | ||
"yargs": "^7.1.0" | ||
"@babel/core": "^7.1.2", | ||
"@babel/preset-env": "^7.1.0", | ||
"babel-loader": "^8.0.4", | ||
"webpack": "^4.25.1", | ||
"webpack-cli": "^3.3.11", | ||
"yargs": "^12.0.2" | ||
} | ||
} |
export default { | ||
url(link, linkResolver) { | ||
if(link.link_type === 'Document') { | ||
return linkResolver ? linkResolver(link, link.isBroken) : ''; | ||
} else { | ||
if ( | ||
link && | ||
[link.link_type, link._linkType, link.linkType].some( | ||
e => e && ["Document", "Link.Document", "Link.document"].includes(e) | ||
) && linkResolver && typeof linkResolver === 'function' | ||
) { | ||
const url = linkResolver(link) | ||
if (url) { | ||
return url | ||
} | ||
} | ||
if (link && link.url) { | ||
return link.url; | ||
} | ||
if (process.env.NODE_ENV !== "production") { | ||
console.warn('PrismicHelpers/Link.url expects a Prismic "link" object as first argument but none was passed'); | ||
} | ||
return ""; | ||
} | ||
} | ||
}; |
@@ -1,18 +0,12 @@ | ||
var webpack = require('webpack'), | ||
path = require('path'), | ||
var path = require('path'), | ||
yargs = require('yargs'); | ||
var libraryName = 'PrismicHelpers', | ||
fileName = 'prismic-helpers', | ||
plugins = [], | ||
outputFile; | ||
fileName = 'prismic-helpers'; | ||
if (yargs.argv.p) { | ||
plugins.push(new webpack.optimize.UglifyJsPlugin({ minimize: true })); | ||
outputFile = fileName + '.min.js'; | ||
} else { | ||
outputFile = fileName + '.js'; | ||
} | ||
var config = { | ||
mode: yargs.argv.p ? 'production' : 'development', | ||
optimization: { | ||
minimize: yargs.argv.p | ||
}, | ||
entry: [ | ||
@@ -23,3 +17,3 @@ __dirname + '/src/index.js' | ||
path: path.join(__dirname, '/dist'), | ||
filename: outputFile, | ||
filename: yargs.argv.p ? (fileName + '.min.js') : (fileName + '.js'), | ||
library: libraryName, | ||
@@ -49,6 +43,5 @@ libraryTarget: 'umd', | ||
extensions: ['.js'] | ||
}, | ||
plugins: plugins | ||
} | ||
}; | ||
module.exports = config; | ||
module.exports = config; |
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
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
5543
9
88