Comments (5)
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.
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.
I can confirm that worked :)
from bundler.
@g-radam
This change is included in v0.5.2. Please check once again with the published version.
from bundler.
@aeworxet I've validated that the issue is fixed in v0.5.2! :) Many thanks aeworxet!
from bundler.
Related Issues (20)
- Cannot bundle documents with different base paths HOT 9
- "invalid-yaml: The provided yaml is not valid" error when passing in JSON HOT 3
- Migrate bundler's codebase to TypeScript HOT 10
- Only `bundle` function should be exposed as part of public API HOT 3
- last release is broken without `lib` dir HOT 33
- Add missing release script to `package.json` HOT 4
- Document how to use package with `require` HOT 7
- Exception is thrown if `$ref` value is not a `string` HOT 2
- Support `referenceIntoComponents` for other components than `message` HOT 55
- base options not working as intended HOT 1
- Cleanup dependencies HOT 2
- Need for urgent changes in GitHub Actions automation HOT 1
- AsyncAPI spec v3 support in Bundler HOT 10
- Export flags to specify which spec is currently supported by bundler HOT 2
- Add option to specify baseFileDir or cwd HOT 5
- Refine AsyncAPI Bundling with Origin Tracing and Component Naming HOT 34
- Use @stoplight/json-ref-resolver instead of @apidevtools/json-schema-ref-parser HOT 4
- Ref's not resolved in v3 documents HOT 15
- [BUG] refs not resolved with a lot of indirection/nesting HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bundler.