Closed pravi closed 7 years ago
Hi Pravi. What build system do you use on gitlab ? Basically I have no external dependency and only need to bundle the require
. So webpack, rollup, whatever, are all fine with me. I can investigate browserify-lite but you say it doesn't work out of the box ?
Error we get in chromium web console is 'Uncaught ReferenceError: process is not defined'. Though https://nodejs.org/api/process.html says its "The process object is a global that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using require()."
nodejs version is 4.3.1. Could that be an issue?
So I have two usage of process
and
First one I think I check that process exist, second one is benchmark so should not be bundled. I can change to compare process with undefined, maybe that'll work better.
I'll release a version once I handle the bower support and review the nugget #30 should be soon. I'll see if I can use -lite by default too.
@jeancroy would 'process' variable be available in browser environment too? Shouldn't browserify-lite convert this too? For now I have hard coded defaultPathSeparator = '/' as this code is expected to run only on debian.
browserify-lite
project page state that No builtin Node.js shims.
without shim, process is available on nodejs but not browser.
I'll also point that the path separator is configurable, it is probably the best choice on browser.
Would this fail on Windows if I hard code to '/'? What other option is there to find the path separator in the browser environment?
OK I'll take one step back. This is used in scoring, amongst other things to focus on filename and so entries that are shallow are preferred.
Fundamentally it's a sensible guess on the format of the candidate list. Are file like c:\folder\folder\file.ext
or /usr/bin/something.so
If I'm on node.js I'll assume the file list is generated from local file system. So then it make sens to interpret the file depending on the local platform.
If i'm on a browser, I'll assume file list come from the server. If every browser has the same file list it doesn't not make sens to interpret on local platform, half the interpretation would be false.
On a browser my guess is that we are dealing with url, so forward slash /
. If you have knowledge that the input format does not follow this pattern it is configurable for each search.
Would this fail on Windows if I hard code to '/'?
Sort-of, on path entries the format c:\folder\folder\file.ext
, everything will be treated as a giant file name, instead of having an understanding of path, extra point on file name match, and prefer shallower entries. If you specify path separator on the option hash you can disregard default completely.
As discussed before, if you use in a browser with a server generated file list, the os of the browser should not matter.
We are packaging fuzzaldrin-plus in debian as it is a dependency for gitlab. We would like to browserify it using tools available in debian. But currently we only have browserify-lite (though we hope to package webpack if we are successful in our corwd funding https://www.generosity.com/community-fundraising/debian-browserify-2) in debian. We could browserify fuzzaldrin-plus with browserify-lite, but it does not work when used in gitlab. See https://gitlab.com/gitlab-org/gitlab-ce/issues/14450
It would be great if you can support using browserify-lite instead of the full browserify suite.