@taqueria/protocol
Version:
A TypeScript package which contains types that are to be shared between @taqueria/node-sdk and @taqueria/taqueria.
104 lines (103 loc) • 3.86 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// tsup.config.ts
var tsup_config_exports = {};
__export(tsup_config_exports, {
default: () => tsup_config_default
});
module.exports = __toCommonJS(tsup_config_exports);
var import_tsup = require("tsup");
var config = {
entry: [
"*.ts",
"out/types/**/*.ts",
"out/*.ts"
],
sourcemap: true,
target: "es2019",
outDir: "./",
dts: false,
clean: false,
shims: true,
bundle: true,
skipNodeModulesBundle: true,
platform: "neutral",
tsconfig: "./tsconfig.json"
// esbuildPlugins: [
// {
// name: 'path-shim',
// setup: build => {
// build.onResolve({ filter: /^path$/ }, _args => {
// const result: esbuild.OnResolveResult = {
// namespace: 'path-shim',
// };
// return result;
// });
// build.onLoad({ filter: /.*/, namespace: 'path-shim' }, _args => {
// const result: esbuild.OnLoadResult = {
// contents: `export {resolve: (filename: str) => filename}`,
// };
// return result;
// });
// },
// },
// // The @taqueria/protocol package is consumed by both the Deno and NodeJS Runtimes
// // As Deno requires relative or absolute paths with file extensions, we use an import map
// // to circumvent around this:
// // E.g.: `import '@taqueria/protocol/out/types/Alias' // maps to ./taqueria-protocol/out/types/Alias`
// //
// // In NodeJS, we can import `@taqueria/protocol/out/types/Alias` from _within_ the `@taqueria/protocol` package.
// // However, in the browser, we cannot - we need to use `./out/types/Alias`
// // This plugin does the search/replace necessary to achieve the above.
// {
// name: 'resolve-generated-output',
// setup: build => {
// const fixImports = (path: string, contents: string) => {
// if (path.includes('out/types')) {
// return contents
// .replace(/(['"])\@taqueria\/protocol\/out\/types\//gm, '$1./')
// .replace(/(['"])\@taqueria\/protocol\/out\//gm, '$1../')
// .replace(/(['"])\@taqueria\/protocol\//gm, '$1../../');
// } else if (path.includes('out')) {
// return contents
// .replace(/(['"])\@taqueria\/protocol\/out\/types\//gm, '$1./types/')
// .replace(/(['"])\@taqueria\/protocol\/out\//gm, '$1./')
// .replace(/(['"])\@taqueria\/protocol\//gm, '$1../');
// } else {
// return contents
// .replace(/(['"])\@taqueria\/protocol\/out\/types\//gm, '$1./out/types/')
// .replace(/(['"])\@taqueria\/protocol\/out\//gm, '$1./out/')
// .replace(/(['"])\@taqueria\/protocol\//gm, '$1./');
// }
// };
// build.onLoad({ filter: /.ts/ }, async ({ path }) => {
// console.error(path);
// const source = await readFile(path, 'utf8');
// const retval: esbuild.OnLoadResult = {
// contents: fixImports(path, source),
// loader: 'ts',
// };
// return retval;
// });
// },
// },
// ],
};
var tsup_config_default = (0, import_tsup.defineConfig)(config);
//# sourceMappingURL=tsup.config.js.map