xml-model 1.1.1 → 1.2.0

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.
package/README.md CHANGED
@@ -13,6 +13,7 @@ import XMLModelVitePlugin from "xml-model/vite";
13
13
  export default defineConfig({
14
14
  plugins: [
15
15
  // see options in JSDoc
16
+ // note that is tsconfig that includes your source files is not tsconfig.json you MUST use the tsconfig option
16
17
  XMLModelVitePlugin(),
17
18
  ],
18
19
  // ... rest of the config
@@ -1,6 +1,7 @@
1
1
  import { Constructor } from 'typescript-rtti';
2
2
  import { XMLModelOptions, XMLModelPropertyOptions, CreateXMLModelOptions } from './types';
3
3
  import { XMLRoot } from '../types';
4
+ export declare function getParentModel(model: XMLModel<any>): XMLModel<any>;
4
5
  export declare class XMLModel<T = any> {
5
6
  readonly type: Constructor<T>;
6
7
  options: XMLModelOptions<T>;
@@ -237,6 +237,7 @@ export {
237
237
  Prop,
238
238
  XMLModel,
239
239
  createModel,
240
- getModel
240
+ getModel,
241
+ getParentModel
241
242
  };
242
243
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xml-model",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "allows transparent XML <-> Object conversion in typescript",
5
5
  "license": "MIT",
6
6
  "author": "MathisTLD",
@@ -21,7 +21,7 @@
21
21
  }
22
22
  },
23
23
  "scripts": {
24
- "preversion": "npm test",
24
+ "preversion": "npm test -- --run",
25
25
  "version": "npm run build",
26
26
  "postversion": "git push && git push --tags",
27
27
  "build": "vite build",
@@ -1,4 +1,5 @@
1
1
  import { Plugin } from 'vite';
2
+ import { RollupTypescriptOptions } from '@rollup/plugin-typescript';
2
3
  /**
3
4
  * When Building, class names are changed but the library relies on them
4
5
  * so they need to be preserved
@@ -6,6 +7,12 @@ import { Plugin } from 'vite';
6
7
  */
7
8
  export declare function FixClassNames(): Plugin;
8
9
  type RTTIPluginOptions = {
10
+ /**
11
+ * options for @rollup/plugin-typescript
12
+ *
13
+ * Plugin might not work if you override the `transformers` property as these options are assigned and not deep merged
14
+ */
15
+ typescript?: RollupTypescriptOptions;
9
16
  /** Files where the rtti transformer should be applied
10
17
  *
11
18
  * If not set, will include every files by default
@@ -21,7 +21,7 @@ function FixClassNames() {
21
21
  };
22
22
  }
23
23
  function TypescriptRTTI(options = {}) {
24
- const { include, exclude, debug = false } = options;
24
+ const { typescript: rollupPluginTypescriptOptions, include, exclude, debug = false } = options;
25
25
  const doTransform = !include && !exclude ? () => true : (path) => {
26
26
  if (exclude?.test(path)) return false;
27
27
  return include ? include.test(path) : true;
@@ -48,7 +48,8 @@ function TypescriptRTTI(options = {}) {
48
48
  ]
49
49
  },
50
50
  // set declaration to `false` to let plugin dts handle the declarations
51
- declaration: false
51
+ declaration: false,
52
+ ...rollupPluginTypescriptOptions
52
53
  });
53
54
  }
54
55
  function XMLModelVitePlugin(options = {}) {