@content-collections/core 0.4.0 → 0.4.1

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 +9 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -45,7 +45,7 @@ import path from "path";
45
45
  // package.json
46
46
  var package_default = {
47
47
  name: "@content-collections/core",
48
- version: "0.4.0",
48
+ version: "0.4.1",
49
49
  type: "module",
50
50
  main: "dist/index.js",
51
51
  types: "./dist/index.d.ts",
@@ -315,11 +315,18 @@ async function createJavaScriptFile(directory, configuration) {
315
315
  content += "export { " + collections.join(", ") + " };\n";
316
316
  await fs2.writeFile(path3.join(directory, "index.js"), content, "utf-8");
317
317
  }
318
+ function createImportPath(directory, target) {
319
+ let importPath = path3.posix.join(...path3.relative(directory, target).split(path3.sep));
320
+ if (!importPath.startsWith(".")) {
321
+ importPath = "./" + importPath;
322
+ }
323
+ return importPath;
324
+ }
318
325
  async function createTypeDefinitionFile(directory, configuration) {
319
326
  if (!configuration.generateTypes) {
320
327
  return;
321
328
  }
322
- const importPath = path3.relative(directory, configuration.path);
329
+ const importPath = createImportPath(directory, configuration.path);
323
330
  let content = `import configuration from "${importPath}";
324
331
  import { GetTypeByName } from "@content-collections/core";
325
332
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@content-collections/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",