vendor: 1,877 bytes, lines 1-58
1/* 2 * Paper.js - The Swiss Army Knife of Vector Graphics Scripting. 3 * http://paperjs.org/ 4 * 5 * Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey 6 * http://juerglehni.com/ & https://puckey.studio/ 7 * 8 * Distributed under the MIT license. See LICENSE file for details. 9 * 10 * All rights reserved. 11 */ 12 13// Node.js emulation layer of browser environment, based on jsdom with node- 14// canvas integration. 15 16var path = require('path'); 17// Determine the name by which name the module was required (either 'paper', 18// 'paper-jsdom' or 'paper-jsdom-canvas'), and use this to determine if error 19// exceptions should be thrown or if loading should fail silently. 20var parent = module.parent && module.parent.parent, 21 requireName = parent && path.basename(path.dirname(parent.filename)); 22requireName = /^paper/.test(requireName) ? requireName : 'paper'; 23 24var jsdom, 25 self; 26 27try { 28 jsdom = require('jsdom'); 29} catch(e) { 30 // Check the required module's name to see if it contains jsdom, and only 31 // complain about its lack if the module requires it. 32 if (/\bjsdom\b/.test(requireName)) { 33 throw new Error('Unable to load jsdom module.'); 34 } 35} 36 37if (jsdom) { 38 // Create our document and window objects through jsdom. 39 /* global document:true, window:true */ 40 var document = new jsdom.JSDOM('<html><body></body></html>', { 41 // Use the current working directory as the document's origin, so 42 // requests to local files work correctly with CORS. 43 url: 'file://' + process.cwd() + '/', 44 resources: 'usable' 45 }); 46 self = document.window; 47 require('./canvas.js.js')(self, requireName); 48 require('./xml.js.js')(self); 49} else { 50 self = { 51 navigator: { 52 userAgent: 'Node.js (' + process.platform + '; U; rv:' + 53 process.version + ')' 54 } 55 }; 56} 57 58module.exports = self;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.