Giter VIP home page Giter VIP logo

Comments (5)

github-actions avatar github-actions commented on July 17, 2024

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

from bundler.

aeworxet avatar aeworxet commented on July 17, 2024

Please copy&paste this compiled index.js to your index.js and check if it solves the issue.

index.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.originDir = void 0;
const fs_1 = require("fs");
const path_1 = __importDefault(require("path"));
const util_1 = require("./util");
const document_1 = require("./document");
const parser_1 = require("./parser");
exports.originDir = String(process.env.PWD);
async function bundle(files, options = {}) {
    // if one string was passed, convert it to an array
    if (typeof files === 'string') {
        files = Array.from(files.split(' '));
    }
    if (options.baseDir && typeof options.baseDir === 'string') {
        process.chdir(path_1.default.resolve(exports.originDir, options.baseDir));
    }
    else if (options.baseDir && Array.isArray(options.baseDir)) {
        process.chdir(path_1.default.resolve(exports.originDir, String(options.baseDir[0]))); // guard against passing an array
    }
    const readFiles = files.map(file => (0, fs_1.readFileSync)(file, 'utf-8')); // eslint-disable-line
    const parsedJsons = readFiles.map(file => (0, util_1.toJS)(file));
    const majorVersion = (0, util_1.versionCheck)(parsedJsons);
    if (typeof options.base !== 'undefined') {
        if (typeof options.base === 'string') {
            options.base = (0, fs_1.readFileSync)(options.base, 'utf-8'); // eslint-disable-line
        }
        else if (Array.isArray(options.base)) {
            options.base = (0, fs_1.readFileSync)(String(options.base[0]), 'utf-8'); // eslint-disable-line
        }
        options.base = (0, util_1.toJS)(options.base);
        await (0, parser_1.parse)(options.base, majorVersion, options);
    }
    const resolvedJsons = await (0, util_1.resolve)(parsedJsons, majorVersion, options);
    process.chdir(exports.originDir);
    return new document_1.Document(resolvedJsons, options.base);
}
exports.default = bundle;
// 'module.exports' is added to maintain backward compatibility with Node.js
// projects, that use CJS module system.
module.exports = bundle;

from bundler.

g-radam avatar g-radam commented on July 17, 2024

I can confirm that worked :)

from bundler.

aeworxet avatar aeworxet commented on July 17, 2024

@g-radam
This change is included in v0.5.2. Please check once again with the published version.

from bundler.

g-radam avatar g-radam commented on July 17, 2024

@aeworxet I've validated that the issue is fixed in v0.5.2! :) Many thanks aeworxet!

from bundler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.