@vercel/ruby 1.2.7 → 1.2.8-canary.3

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -55
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -8608,25 +8608,6 @@ function coerce (version, options) {
8608
8608
  }
8609
8609
 
8610
8610
 
8611
- /***/ }),
8612
-
8613
- /***/ 9798:
8614
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
8615
-
8616
- "use strict";
8617
-
8618
- Object.defineProperty(exports, "__esModule", ({ value: true }));
8619
- let buildUtils;
8620
- try {
8621
- buildUtils = __webpack_require__(3445);
8622
- }
8623
- catch (e) {
8624
- // Fallback for older CLI versions
8625
- buildUtils = __webpack_require__(9688);
8626
- }
8627
- exports.default = buildUtils;
8628
-
8629
-
8630
8611
  /***/ }),
8631
8612
 
8632
8613
  /***/ 2178:
@@ -8642,8 +8623,7 @@ exports.build = exports.version = void 0;
8642
8623
  const path_1 = __webpack_require__(5622);
8643
8624
  const execa_1 = __importDefault(__webpack_require__(4237));
8644
8625
  const fs_extra_1 = __webpack_require__(5392);
8645
- const build_utils_1 = __importDefault(__webpack_require__(9798));
8646
- const { download, getWriteableDirectory, glob, createLambda, debug, walkParentDirs, } = build_utils_1.default;
8626
+ const build_utils_1 = __webpack_require__(3445);
8647
8627
  const install_ruby_1 = __webpack_require__(2421);
8648
8628
  async function matchPaths(configPatterns, workPath) {
8649
8629
  const patterns = typeof configPatterns === 'string' ? [configPatterns] : configPatterns;
@@ -8651,14 +8631,14 @@ async function matchPaths(configPatterns, workPath) {
8651
8631
  return [];
8652
8632
  }
8653
8633
  const patternPaths = await Promise.all(patterns.map(async (pattern) => {
8654
- const files = await glob(pattern, workPath);
8634
+ const files = await build_utils_1.glob(pattern, workPath);
8655
8635
  return Object.keys(files);
8656
8636
  }));
8657
8637
  return patternPaths.reduce((a, b) => a.concat(b), []);
8658
8638
  }
8659
8639
  async function bundleInstall(bundlePath, bundleDir, gemfilePath) {
8660
- debug(`running "bundle install --deployment"...`);
8661
- const bundleAppConfig = await getWriteableDirectory();
8640
+ build_utils_1.debug(`running "bundle install --deployment"...`);
8641
+ const bundleAppConfig = await build_utils_1.getWriteableDirectory();
8662
8642
  try {
8663
8643
  await execa_1.default(bundlePath, [
8664
8644
  'install',
@@ -8677,15 +8657,15 @@ async function bundleInstall(bundlePath, bundleDir, gemfilePath) {
8677
8657
  });
8678
8658
  }
8679
8659
  catch (err) {
8680
- debug(`failed to run "bundle install --deployment"...`);
8660
+ build_utils_1.debug(`failed to run "bundle install --deployment"...`);
8681
8661
  throw err;
8682
8662
  }
8683
8663
  }
8684
8664
  exports.version = 3;
8685
8665
  async function build({ workPath, files, entrypoint, config, meta = {}, }) {
8686
- await download(files, workPath, meta);
8666
+ await build_utils_1.download(files, workPath, meta);
8687
8667
  const entrypointFsDirname = path_1.join(workPath, path_1.dirname(entrypoint));
8688
- const gemfilePath = await walkParentDirs({
8668
+ const gemfilePath = await build_utils_1.walkParentDirs({
8689
8669
  base: workPath,
8690
8670
  start: entrypointFsDirname,
8691
8671
  filename: 'Gemfile',
@@ -8695,7 +8675,7 @@ async function build({ workPath, files, entrypoint, config, meta = {}, }) {
8695
8675
  : '';
8696
8676
  const { gemHome, bundlerPath, vendorPath, runtime } = await install_ruby_1.installBundler(meta, gemfileContents);
8697
8677
  process.env.GEM_HOME = gemHome;
8698
- debug(`Checking existing vendor directory at "${vendorPath}"`);
8678
+ build_utils_1.debug(`Checking existing vendor directory at "${vendorPath}"`);
8699
8679
  const vendorDir = path_1.join(workPath, vendorPath);
8700
8680
  const bundleDir = path_1.join(workPath, 'vendor', 'bundle');
8701
8681
  const relativeVendorDir = path_1.join(entrypointFsDirname, vendorPath);
@@ -8704,35 +8684,35 @@ async function build({ workPath, files, entrypoint, config, meta = {}, }) {
8704
8684
  const hasVendorDir = hasRootVendorDir || hasRelativeVendorDir;
8705
8685
  if (hasRelativeVendorDir) {
8706
8686
  if (hasRootVendorDir) {
8707
- debug('found two vendor directories, choosing the vendor directory relative to entrypoint');
8687
+ build_utils_1.debug('found two vendor directories, choosing the vendor directory relative to entrypoint');
8708
8688
  }
8709
8689
  else {
8710
- debug('found vendor directory relative to entrypoint');
8690
+ build_utils_1.debug('found vendor directory relative to entrypoint');
8711
8691
  }
8712
8692
  // vendor dir must be at the root for lambda to find it
8713
8693
  await fs_extra_1.move(relativeVendorDir, vendorDir);
8714
8694
  }
8715
8695
  else if (hasRootVendorDir) {
8716
- debug('found vendor directory in project root');
8696
+ build_utils_1.debug('found vendor directory in project root');
8717
8697
  }
8718
8698
  await fs_extra_1.ensureDir(vendorDir);
8719
8699
  // no vendor directory, check for Gemfile to install
8720
8700
  if (!hasVendorDir) {
8721
8701
  if (gemfilePath) {
8722
- debug('did not find a vendor directory but found a Gemfile, bundling gems...');
8702
+ build_utils_1.debug('did not find a vendor directory but found a Gemfile, bundling gems...');
8723
8703
  // try installing. this won't work if native extesions are required.
8724
8704
  // if that's the case, gems should be vendored locally before deploying.
8725
8705
  try {
8726
8706
  await bundleInstall(bundlerPath, bundleDir, gemfilePath);
8727
8707
  }
8728
8708
  catch (err) {
8729
- debug('unable to build gems from Gemfile. vendor the gems locally with "bundle install --deployment" and retry.');
8709
+ build_utils_1.debug('unable to build gems from Gemfile. vendor the gems locally with "bundle install --deployment" and retry.');
8730
8710
  throw err;
8731
8711
  }
8732
8712
  }
8733
8713
  }
8734
8714
  else {
8735
- debug('found vendor directory, skipping "bundle install"...');
8715
+ build_utils_1.debug('found vendor directory, skipping "bundle install"...');
8736
8716
  }
8737
8717
  // try to remove gem cache to slim bundle size
8738
8718
  try {
@@ -8745,14 +8725,14 @@ async function build({ workPath, files, entrypoint, config, meta = {}, }) {
8745
8725
  const originalHandlerRbContents = await fs_extra_1.readFile(originalRbPath, 'utf8');
8746
8726
  // will be used on `require_relative '$here'` or for loading rack config.ru file
8747
8727
  // for example, `require_relative 'api/users'`
8748
- debug('entrypoint is', entrypoint);
8728
+ build_utils_1.debug('entrypoint is', entrypoint);
8749
8729
  const userHandlerFilePath = entrypoint.replace(/\.rb$/, '');
8750
8730
  const nowHandlerRbContents = originalHandlerRbContents.replace(/__VC_HANDLER_FILENAME/g, userHandlerFilePath);
8751
8731
  // in order to allow the user to have `server.rb`, we need our `server.rb` to be called
8752
8732
  // somethig else
8753
8733
  const handlerRbFilename = 'vc__handler__ruby';
8754
8734
  await fs_extra_1.writeFile(path_1.join(workPath, `${handlerRbFilename}.rb`), nowHandlerRbContents);
8755
- const outputFiles = await glob('**', workPath);
8735
+ const outputFiles = await build_utils_1.glob('**', workPath);
8756
8736
  // static analysis is impossible with ruby.
8757
8737
  // instead, provide `includeFiles` and `excludeFiles` config options to reduce bundle size.
8758
8738
  if (config && (config.includeFiles || config.excludeFiles)) {
@@ -8774,7 +8754,7 @@ async function build({ workPath, files, entrypoint, config, meta = {}, }) {
8774
8754
  delete outputFiles[excludedPaths[i]];
8775
8755
  }
8776
8756
  }
8777
- const lambda = await createLambda({
8757
+ const lambda = await build_utils_1.createLambda({
8778
8758
  files: outputFiles,
8779
8759
  handler: `${handlerRbFilename}.vc__handler`,
8780
8760
  runtime,
@@ -8800,8 +8780,7 @@ exports.installBundler = void 0;
8800
8780
  const path_1 = __webpack_require__(5622);
8801
8781
  const semver_1 = __webpack_require__(2879);
8802
8782
  const execa_1 = __importDefault(__webpack_require__(4237));
8803
- const build_utils_1 = __importDefault(__webpack_require__(9798));
8804
- const { debug, NowBuildError } = build_utils_1.default;
8783
+ const build_utils_1 = __webpack_require__(3445);
8805
8784
  const allOptions = [
8806
8785
  { major: 2, minor: 7, range: '2.7.x', runtime: 'ruby2.7' },
8807
8786
  { major: 2, minor: 5, range: '2.5.x', runtime: 'ruby2.5' },
@@ -8819,11 +8798,7 @@ function getRubyPath(meta, gemfileContents) {
8819
8798
  .split('\n')
8820
8799
  .find(line => line.startsWith('ruby'));
8821
8800
  if (line) {
8822
- const strVersion = line
8823
- .slice(4)
8824
- .trim()
8825
- .slice(1, -1)
8826
- .replace('~>', '');
8801
+ const strVersion = line.slice(4).trim().slice(1, -1).replace('~>', '');
8827
8802
  const found = allOptions.some(o => {
8828
8803
  // The array is already in order so return the first
8829
8804
  // match which will be the newest version.
@@ -8831,7 +8806,7 @@ function getRubyPath(meta, gemfileContents) {
8831
8806
  return semver_1.intersects(o.range, strVersion);
8832
8807
  });
8833
8808
  if (!found) {
8834
- throw new NowBuildError({
8809
+ throw new build_utils_1.NowBuildError({
8835
8810
  code: 'RUBY_INVALID_VERSION',
8836
8811
  message: 'Found `Gemfile` with invalid Ruby version: `' + line + '`.',
8837
8812
  link: 'https://vercel.com/docs/runtimes#official-runtimes/ruby/ruby-version',
@@ -8848,7 +8823,7 @@ function getRubyPath(meta, gemfileContents) {
8848
8823
  gemPath: path_1.join(gemHome, 'bin', 'gem'),
8849
8824
  vendorPath: `vendor/bundle/ruby/${major}.${minor}.0`,
8850
8825
  };
8851
- debug(JSON.stringify(result, null, ' '));
8826
+ build_utils_1.debug(JSON.stringify(result, null, ' '));
8852
8827
  return result;
8853
8828
  }
8854
8829
  // downloads and installs `bundler` (respecting
@@ -8856,7 +8831,7 @@ function getRubyPath(meta, gemfileContents) {
8856
8831
  // the absolute path to it
8857
8832
  async function installBundler(meta, gemfileContents) {
8858
8833
  const { gemHome, rubyPath, gemPath, vendorPath, runtime } = getRubyPath(meta, gemfileContents);
8859
- debug('installing bundler...');
8834
+ build_utils_1.debug('installing bundler...');
8860
8835
  await execa_1.default(gemPath, ['install', 'bundler', '--no-document'], {
8861
8836
  stdio: 'pipe',
8862
8837
  env: {
@@ -8875,14 +8850,6 @@ async function installBundler(meta, gemfileContents) {
8875
8850
  exports.installBundler = installBundler;
8876
8851
 
8877
8852
 
8878
- /***/ }),
8879
-
8880
- /***/ 9688:
8881
- /***/ ((module) => {
8882
-
8883
- "use strict";
8884
- module.exports = require("@now/build-utils");
8885
-
8886
8853
  /***/ }),
8887
8854
 
8888
8855
  /***/ 3445:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vercel/ruby",
3
3
  "author": "Nathan Cahill <nathan@nathancahill.com>",
4
- "version": "1.2.7",
4
+ "version": "1.2.8-canary.3",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index",
7
7
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",
@@ -28,5 +28,5 @@
28
28
  "semver": "6.1.1",
29
29
  "typescript": "4.3.4"
30
30
  },
31
- "gitHead": "1a776ad3438a435c4ee8cca462b06d09a7d43008"
31
+ "gitHead": "4e52f8532baada6d9c2e9c537784abcd8f9fd65b"
32
32
  }