meca 0.0.2 → 1.0.4

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.
@@ -1,5 +1,4 @@
1
- import type { JatsOptions } from 'jats-xml';
2
- import type { ISession } from '../types.js';
1
+ import type { ISession, JatsOptions } from 'jats-xml';
3
2
  /**
4
3
  * Validate a given file as MECA bundle
5
4
  *
@@ -109,9 +109,18 @@ export async function validateMeca(session, file, opts) {
109
109
  const manifestString = manifestEntry.getData().toString();
110
110
  const manifestItems = extractManifestItems(manifestString);
111
111
  const zipEntries = mecaZip.getEntries();
112
+ // Get all file and folder names in the zip file.
113
+ // Folders may not be explicitly listed in zipEntries, so we compute all folders from file paths.
114
+ const zipEntryNames = new Set();
115
+ zipEntries.forEach((entry) => {
116
+ const nameParts = entry.entryName.split('/');
117
+ for (let i = 1; i <= nameParts.length; i++) {
118
+ zipEntryNames.add(nameParts.slice(0, i).join('/'));
119
+ }
120
+ });
112
121
  const manifestExtras = manifestItems
113
- .filter((item) => !zipEntries.map((entry) => entry.entryName).includes(item.href))
114
- .map((item) => item.href);
122
+ .map((item) => item.href)
123
+ .filter((href) => !zipEntryNames.has(href.replace(/\/$/, ''))); // Ignore trailing slash
115
124
  const zipExtras = zipEntries
116
125
  .filter((entry) => entry.entryName !== MANIFEST)
117
126
  .filter((entry) => !entry.isDirectory)
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const version = "0.0.2";
1
+ declare const version = "1.0.4";
2
2
  export default version;
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- const version = '0.0.2';
1
+ const version = '1.0.4';
2
2
  export default version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meca",
3
- "version": "0.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Types and utilities for working with MECA",
5
5
  "author": "Rowan Cockett <rowan@curvenote.com>",
6
6
  "homepage": "https://github.com/curvenote/meca",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "adm-zip": "^0.5.10",
48
- "jats-xml": "^1.0.2",
48
+ "jats-xml": "^1.0.4",
49
49
  "xml-js": "^1.6.11"
50
50
  },
51
51
  "peerDependencies": {
package/dist/session.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import type { Logger } from 'myst-cli-utils';
2
- import type { ISession } from './types.js';
3
- export declare class Session implements ISession {
4
- log: Logger;
5
- constructor(opts?: {
6
- logger?: Logger;
7
- });
8
- }
9
- export declare function getSession(logger: Logger): Session;
package/dist/session.js DELETED
@@ -1,10 +0,0 @@
1
- import { chalkLogger, LogLevel } from 'myst-cli-utils';
2
- export class Session {
3
- constructor(opts) {
4
- var _a;
5
- this.log = (_a = opts === null || opts === void 0 ? void 0 : opts.logger) !== null && _a !== void 0 ? _a : chalkLogger(LogLevel.debug);
6
- }
7
- }
8
- export function getSession(logger) {
9
- return new Session({ logger });
10
- }
package/dist/types.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import type { ISession as BaseISession } from 'myst-cli-utils';
2
- export type ISession = BaseISession;
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- export {};