projen 0.103.4 → 0.103.6
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/.jsii +1565 -36
- package/lib/ai-instructions.js +2 -2
- package/lib/awscdk/auto-discover.js +6 -6
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-py.js +1 -1
- package/lib/awscdk/awscdk-app-ts.js +1 -1
- package/lib/awscdk/awscdk-construct.js +1 -1
- package/lib/awscdk/awscdk-deps-java.js +1 -1
- package/lib/awscdk/awscdk-deps-js.js +1 -1
- package/lib/awscdk/awscdk-deps-py.js +1 -1
- package/lib/awscdk/awscdk-deps.js +1 -1
- package/lib/awscdk/cdk-config.js +3 -3
- package/lib/awscdk/cdk-tasks.js +1 -1
- package/lib/awscdk/integration-test.js +1 -1
- package/lib/awscdk/lambda-extension.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/auto-discover-base.js +2 -2
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/integration-test-base.js +1 -1
- package/lib/cdk/jsii-build.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/auto-discover.js +2 -2
- package/lib/cdk8s/cdk8s-app-py.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/cdk8s-deps-py.js +1 -1
- package/lib/cdk8s/cdk8s-deps.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/cdktn/cdktn-app-ts.js +1 -1
- package/lib/cdktn/cdktn-config.js +1 -1
- package/lib/cdktn/cdktn-construct.js +1 -1
- package/lib/cdktn/cdktn-deps.js +1 -1
- package/lib/cdktn/cdktn-tasks.js +1 -1
- package/lib/circleci/circleci.js +1 -1
- package/lib/component.js +2 -2
- package/lib/dependencies.js +1 -1
- package/lib/dev-env.js +1 -1
- package/lib/docker-compose/docker-compose-service.js +1 -1
- package/lib/docker-compose/docker-compose.js +1 -1
- package/lib/file.js +1 -1
- package/lib/gitattributes.js +1 -1
- package/lib/github/actions-provider.js +1 -1
- package/lib/github/auto-approve.js +1 -1
- package/lib/github/auto-merge.js +1 -1
- package/lib/github/auto-queue.js +1 -1
- package/lib/github/dependabot.js +1 -1
- package/lib/github/dependency-review.js +1 -1
- package/lib/github/github-credentials.js +1 -1
- package/lib/github/github-project.js +1 -1
- package/lib/github/github.js +1 -1
- package/lib/github/merge-queue.js +1 -1
- package/lib/github/mergify.js +1 -1
- package/lib/github/pr-template.js +1 -1
- package/lib/github/pull-request-backport.js +1 -1
- package/lib/github/pull-request-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow-job.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflow-actions.js +1 -1
- package/lib/github/workflow-jobs.js +1 -1
- package/lib/github/workflow-steps.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration.js +1 -1
- package/lib/gitlab/gitlab-configuration.js +1 -1
- package/lib/gitlab/nested-configuration.js +1 -1
- package/lib/gitpod.js +1 -1
- package/lib/ignore-file.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +4 -2
- package/lib/ini.js +1 -1
- package/lib/java/java-project.js +1 -1
- package/lib/java/junit.js +1 -1
- package/lib/java/maven-compile.js +1 -1
- package/lib/java/maven-packaging.js +1 -1
- package/lib/java/maven-sample.js +1 -1
- package/lib/java/pom.js +2 -2
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/biome/biome.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +1 -1
- package/lib/javascript/jest.js +4 -4
- package/lib/javascript/license-checker.js +1 -1
- package/lib/javascript/node-config-file.js +1 -1
- package/lib/javascript/node-package.js +9 -2
- package/lib/javascript/node-project.js +1 -1
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/pnpm-workspace-config.js +2 -2
- package/lib/javascript/pnpm-workspace.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +2 -2
- package/lib/javascript/upgrade-dependencies.js +2 -2
- package/lib/javascript/yarnrc.js +1 -1
- package/lib/json-patch.js +1 -1
- package/lib/json.js +1 -1
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project-tree.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +1 -1
- package/lib/projenrc.js +1 -1
- package/lib/properties-file.d.ts +50 -0
- package/lib/properties-file.js +77 -0
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.js +2 -2
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pyproject-toml-file.js +1 -1
- package/lib/python/pytest-sample.js +1 -1
- package/lib/python/pytest.js +1 -1
- package/lib/python/python-project.js +1 -1
- package/lib/python/python-sample.js +1 -1
- package/lib/python/requirements-file.js +1 -1
- package/lib/python/setuppy.js +1 -1
- package/lib/python/setuptools.js +1 -1
- package/lib/python/uv-config.js +1 -1
- package/lib/python/uv.js +1 -1
- package/lib/python/venv.js +1 -1
- package/lib/readme.js +1 -1
- package/lib/release/publisher.js +1 -1
- package/lib/release/release-trigger.js +1 -1
- package/lib/release/release.js +1 -1
- package/lib/renovatebot.js +1 -1
- package/lib/run-task.cjs +7 -5
- package/lib/sample-file.js +2 -2
- package/lib/script-runner.js +1 -1
- package/lib/sonarqube/index.d.ts +4 -0
- package/lib/sonarqube/index.js +21 -0
- package/lib/sonarqube/javascript.d.ts +35 -0
- package/lib/sonarqube/javascript.js +57 -0
- package/lib/sonarqube/rust.d.ts +37 -0
- package/lib/sonarqube/rust.js +58 -0
- package/lib/sonarqube/sonarqube.d.ts +439 -0
- package/lib/sonarqube/sonarqube.js +184 -0
- package/lib/sonarqube/typescript.d.ts +36 -0
- package/lib/sonarqube/typescript.js +61 -0
- package/lib/source-code.js +1 -1
- package/lib/task-shell.js +1 -1
- package/lib/task.js +1 -1
- package/lib/tasks.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/textfile.js +1 -1
- package/lib/toml.js +1 -1
- package/lib/typescript/projenrc-ts.js +1 -1
- package/lib/typescript/projenrc.js +1 -1
- package/lib/typescript/typescript-runner.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +5 -5
- package/lib/util.d.ts +9 -0
- package/lib/util.js +39 -1
- package/lib/version.js +2 -2
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/extensions.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/settings.js +1 -1
- package/lib/vscode/vscode.js +1 -1
- package/lib/web/next.js +3 -3
- package/lib/web/postcss.js +1 -1
- package/lib/web/react.js +3 -3
- package/lib/web/tailwind.js +1 -1
- package/lib/xmlfile.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/properties-file/LICENSE +21 -0
- package/node_modules/properties-file/README.md +253 -0
- package/node_modules/properties-file/dist/cjs/bundler/bun.d.ts +10 -0
- package/node_modules/properties-file/dist/cjs/bundler/bun.js +1 -0
- package/node_modules/properties-file/dist/cjs/bundler/esbuild.d.ts +11 -0
- package/node_modules/properties-file/dist/cjs/bundler/esbuild.js +1 -0
- package/node_modules/properties-file/dist/cjs/bundler/rollup.d.ts +11 -0
- package/node_modules/properties-file/dist/cjs/bundler/rollup.js +1 -0
- package/node_modules/properties-file/dist/cjs/bundler/webpack.d.ts +12 -0
- package/node_modules/properties-file/dist/cjs/bundler/webpack.js +1 -0
- package/node_modules/properties-file/dist/cjs/characters.d.ts +32 -0
- package/node_modules/properties-file/dist/cjs/characters.js +1 -0
- package/node_modules/properties-file/dist/cjs/editor/index.d.ts +181 -0
- package/node_modules/properties-file/dist/cjs/editor/index.js +1 -0
- package/node_modules/properties-file/dist/cjs/escape/index.d.ts +18 -0
- package/node_modules/properties-file/dist/cjs/escape/index.js +1 -0
- package/node_modules/properties-file/dist/cjs/index.d.ts +25 -0
- package/node_modules/properties-file/dist/cjs/index.js +1 -0
- package/node_modules/properties-file/dist/cjs/package.json +1 -0
- package/node_modules/properties-file/dist/cjs/parser/index.d.ts +3 -0
- package/node_modules/properties-file/dist/cjs/parser/index.js +1 -0
- package/node_modules/properties-file/dist/cjs/parser/nodes.d.ts +154 -0
- package/node_modules/properties-file/dist/cjs/parser/nodes.js +1 -0
- package/node_modules/properties-file/dist/cjs/parser/normalize.d.ts +12 -0
- package/node_modules/properties-file/dist/cjs/parser/normalize.js +1 -0
- package/node_modules/properties-file/dist/cjs/parser/parse.d.ts +23 -0
- package/node_modules/properties-file/dist/cjs/parser/parse.js +1 -0
- package/node_modules/properties-file/dist/cjs/parser/properties.d.ts +93 -0
- package/node_modules/properties-file/dist/cjs/parser/properties.js +1 -0
- package/node_modules/properties-file/dist/cjs/properties-file.d.ts +8 -0
- package/node_modules/properties-file/dist/cjs/unescape/index.d.ts +14 -0
- package/node_modules/properties-file/dist/cjs/unescape/index.js +1 -0
- package/node_modules/properties-file/dist/esm/bundler/bun.d.ts +10 -0
- package/node_modules/properties-file/dist/esm/bundler/bun.js +1 -0
- package/node_modules/properties-file/dist/esm/bundler/esbuild.d.ts +11 -0
- package/node_modules/properties-file/dist/esm/bundler/esbuild.js +1 -0
- package/node_modules/properties-file/dist/esm/bundler/rollup.d.ts +11 -0
- package/node_modules/properties-file/dist/esm/bundler/rollup.js +1 -0
- package/node_modules/properties-file/dist/esm/bundler/webpack.d.ts +12 -0
- package/node_modules/properties-file/dist/esm/bundler/webpack.js +1 -0
- package/node_modules/properties-file/dist/esm/characters.d.ts +32 -0
- package/node_modules/properties-file/dist/esm/characters.js +1 -0
- package/node_modules/properties-file/dist/esm/editor/index.d.ts +181 -0
- package/node_modules/properties-file/dist/esm/editor/index.js +1 -0
- package/node_modules/properties-file/dist/esm/escape/index.d.ts +18 -0
- package/node_modules/properties-file/dist/esm/escape/index.js +1 -0
- package/node_modules/properties-file/dist/esm/index.d.ts +25 -0
- package/node_modules/properties-file/dist/esm/index.js +1 -0
- package/node_modules/properties-file/dist/esm/parser/index.d.ts +3 -0
- package/node_modules/properties-file/dist/esm/parser/index.js +1 -0
- package/node_modules/properties-file/dist/esm/parser/nodes.d.ts +154 -0
- package/node_modules/properties-file/dist/esm/parser/nodes.js +1 -0
- package/node_modules/properties-file/dist/esm/parser/normalize.d.ts +12 -0
- package/node_modules/properties-file/dist/esm/parser/normalize.js +1 -0
- package/node_modules/properties-file/dist/esm/parser/parse.d.ts +23 -0
- package/node_modules/properties-file/dist/esm/parser/parse.js +1 -0
- package/node_modules/properties-file/dist/esm/parser/properties.d.ts +93 -0
- package/node_modules/properties-file/dist/esm/parser/properties.js +1 -0
- package/node_modules/properties-file/dist/esm/properties-file.d.ts +8 -0
- package/node_modules/properties-file/dist/esm/unescape/index.d.ts +14 -0
- package/node_modules/properties-file/dist/esm/unescape/index.js +1 -0
- package/node_modules/properties-file/package.json +190 -0
- package/package.json +7 -5
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A key-value pair object.
|
|
3
|
+
*/
|
|
4
|
+
export type KeyValuePairObject = Record<string, string>;
|
|
5
|
+
/**
|
|
6
|
+
* Converts the content of a `.properties` file to a key-value pair object.
|
|
7
|
+
*
|
|
8
|
+
* This is a self-contained, zero-dependency parser optimized for minimal
|
|
9
|
+
* bundle size. It implements the Java `java.util.Properties` specification:
|
|
10
|
+
*
|
|
11
|
+
* - BOM detection and skipping
|
|
12
|
+
* - Comment lines (`#` or `!`)
|
|
13
|
+
* - Line continuations (trailing odd backslash)
|
|
14
|
+
* - Key-value separator detection (`=`, `:`, or whitespace)
|
|
15
|
+
* - Escape sequence processing (`\\n`, `\\t`, `\\r`, `\\f`, `\\\\`, `\\uXXXX`)
|
|
16
|
+
* - Last-value-wins semantics for duplicate keys
|
|
17
|
+
*
|
|
18
|
+
* @param content - The content of a `.properties` file.
|
|
19
|
+
*
|
|
20
|
+
* @returns A key/value object representing the content of a `.properties` file.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getProperties: (content: string | Buffer) => KeyValuePairObject;
|
|
23
|
+
|
|
24
|
+
// Enables type recognition for direct `.properties` file imports.
|
|
25
|
+
import './properties-file.d.ts'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"getProperties",{enumerable:!0,get:function(){return q}});var _=function(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1},S=function(e){if(-1===e.indexOf("\\"))return e;for(var r=e.length,a="",t=0,c=0;c<r;)if(92===e.charCodeAt(c)){if(c>t&&(a+=e.slice(t,c)),++c>=r){a+="\\",t=c;break}switch(e.charCodeAt(c)){case 110:a+="\n",c++;break;case 116:a+="\t",c++;break;case 114:a+="\r",c++;break;case 102:a+="\f",c++;break;case 117:if(c+4>=r)throw new Error("malformed escaped unicode characters '".concat(e.slice(c-1,c+5),"'"));var o=_(e.charCodeAt(c+1)),i=_(e.charCodeAt(c+2)),n=_(e.charCodeAt(c+3)),f=_(e.charCodeAt(c+4));if(o<0||i<0||n<0||f<0)throw new Error("malformed escaped unicode characters '".concat(e.slice(c-1,c+5),"'"));a+=String.fromCharCode(o<<12|i<<8|n<<4|f),c+=5;break;default:a+=e.charAt(c),c++}t=c}else c++;return t<r&&(a+=e.slice(t,r)),a},H=function(e,r,a){for(;r<a;){var t=e.charCodeAt(r);if(32!==t&&9!==t&&12!==t)break;r++}return r},q=function(e){for(var r="string"==typeof e?e:e.toString(),a={},t=(r.length>0&&65279===r.charCodeAt(0)?r.slice(1):r).split(/\r\n|\r|\n/),c=t.length,o=0;o<c;){var i=t[o],n=i.length,f=H(i,0,n);if(f>=n)o++;else{var s=i.charCodeAt(f);if(35!==s&&33!==s){for(var d=0,l=n-1;l>=0&&92===i.charCodeAt(l);l--)d++;var h=d%2==1,v=void 0,u=void 0;if(h){var C=(f>0?i.slice(f):i).slice(0,-1),A=[C];for(u=-1!==C.indexOf("\\");h&&o+1<c;){var b=t[++o],g=b.length,p=H(b,0,g);d=0;for(var k=g-1;k>=p&&92===b.charCodeAt(k);k--)d++;var _=(h=d%2==1)?b.slice(p,g-1):b.slice(p);!u&&-1!==_.indexOf("\\")&&(u=!0),A.push(_)}v=A.join("")}else u=-1!==(v=f>0?i.slice(f):i).indexOf("\\");for(var m=v.length,x=0,O=!1;x<m;){var w=v.charCodeAt(x);if(92!==w){if(!O&&(61===w||58===w||32===w||9===w||12===w))break;O=!1,x++}else O=!O,x++}var j=x;if(j<m){var y=v.charCodeAt(j);(32===y||9===y||12===y)&&((j=H(v,j,m))<m&&(y=v.charCodeAt(j))),j<m&&(61===y||58===y)&&(j++,j=H(v,j,m))}var P=v.slice(0,x),q=v.slice(j);a[u?S(P):P]=u?S(q):q,o++}else o++}}return a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs" }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function _export(e,r){for(var t in r)Object.defineProperty(e,t,{enumerable:!0,get:Object.getOwnPropertyDescriptor(r,t).get})}Object.defineProperty(exports,"__esModule",{value:!0}),_export(exports,{get Properties(){return _properties.Properties},get PropertiesNodeType(){return _nodes.PropertiesNodeType}});var _properties=require("./properties.js"),_nodes=require("./nodes.js");
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/** Constants for the `type` discriminator on each node. */
|
|
2
|
+
export declare const PropertiesNodeType: {
|
|
3
|
+
/** A property (key-value pair). */
|
|
4
|
+
readonly PROPERTY: "property";
|
|
5
|
+
/** A comment line (`#` or `!`). */
|
|
6
|
+
readonly COMMENT: "comment";
|
|
7
|
+
/** A blank line. */
|
|
8
|
+
readonly BLANK: "blank";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A property (key-value pair), potentially spanning multiple physical lines
|
|
12
|
+
* via backslash continuation.
|
|
13
|
+
*/
|
|
14
|
+
export type PropertyNode = {
|
|
15
|
+
/** Discriminator. */
|
|
16
|
+
readonly type: 'property';
|
|
17
|
+
/** Physical lines as-is (without EOL characters), for lossless reconstruction. */
|
|
18
|
+
readonly rawLines: string[];
|
|
19
|
+
/** Leading whitespace before the key on the first physical line. */
|
|
20
|
+
readonly leadingWhitespace: string;
|
|
21
|
+
/** The unescaped key. */
|
|
22
|
+
readonly key: string;
|
|
23
|
+
/** The key as written in the source (after continuation joining, before unescaping). */
|
|
24
|
+
readonly escapedKey: string;
|
|
25
|
+
/** Whitespace between the key and the separator character. */
|
|
26
|
+
readonly separatorLeading: string;
|
|
27
|
+
/**
|
|
28
|
+
* The core separator character.
|
|
29
|
+
*
|
|
30
|
+
* - `'='` or `':'` when an explicit delimiter is used.
|
|
31
|
+
* - `undefined` when whitespace alone separates key from value, or when
|
|
32
|
+
* the property is key-only with no separator.
|
|
33
|
+
*/
|
|
34
|
+
readonly separatorChar: '=' | ':' | undefined;
|
|
35
|
+
/** Whitespace between the separator character and the value. */
|
|
36
|
+
readonly separatorTrailing: string;
|
|
37
|
+
/** The unescaped value. */
|
|
38
|
+
readonly value: string;
|
|
39
|
+
/** The value as written in the source (after continuation joining, before unescaping). */
|
|
40
|
+
readonly escapedValue: string;
|
|
41
|
+
/** 1-based line number where this property starts. */
|
|
42
|
+
readonly startingLineNumber: number;
|
|
43
|
+
/** 1-based line number where this property ends. */
|
|
44
|
+
readonly endingLineNumber: number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* A comment line starting with `#` or `!`.
|
|
48
|
+
*/
|
|
49
|
+
export type CommentNode = {
|
|
50
|
+
/** Discriminator. */
|
|
51
|
+
readonly type: 'comment';
|
|
52
|
+
/** The full line as-is (without the EOL character). */
|
|
53
|
+
readonly rawLine: string;
|
|
54
|
+
/** Leading whitespace before the delimiter. */
|
|
55
|
+
readonly leadingWhitespace: string;
|
|
56
|
+
/** The comment delimiter character. */
|
|
57
|
+
readonly delimiter: '#' | '!';
|
|
58
|
+
/** The text after the delimiter (including any space immediately after it). */
|
|
59
|
+
readonly body: string;
|
|
60
|
+
/** 1-based line number. */
|
|
61
|
+
readonly lineNumber: number;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* A blank line (may contain only whitespace characters).
|
|
65
|
+
*/
|
|
66
|
+
export type BlankLineNode = {
|
|
67
|
+
/** Discriminator. */
|
|
68
|
+
readonly type: 'blank';
|
|
69
|
+
/** The raw whitespace content of the line (without the EOL character). */
|
|
70
|
+
readonly rawLine: string;
|
|
71
|
+
/** 1-based line number. */
|
|
72
|
+
readonly lineNumber: number;
|
|
73
|
+
};
|
|
74
|
+
/** Discriminated union of all node types in a `.properties` file. */
|
|
75
|
+
export type PropertiesNode = PropertyNode | CommentNode | BlankLineNode;
|
|
76
|
+
/** A plain key-value pair object where every value is a string. */
|
|
77
|
+
export type KeyValuePairObject = Record<string, string>;
|
|
78
|
+
/** Information about a key that appears more than once. */
|
|
79
|
+
export type KeyCollisions = {
|
|
80
|
+
/** The duplicate key. */
|
|
81
|
+
key: string;
|
|
82
|
+
/** All property nodes with this key, in file order. */
|
|
83
|
+
nodes: PropertyNode[];
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Options for {@link Properties.format} when producing normalized output.
|
|
87
|
+
*
|
|
88
|
+
* When no options are passed to `format()`, the output is a lossless reconstruction
|
|
89
|
+
* of the original content. Passing any option triggers normalization, rebuilding
|
|
90
|
+
* property lines from their parsed fields.
|
|
91
|
+
*/
|
|
92
|
+
export type NormalizeOptions = {
|
|
93
|
+
/** Override the end-of-line character. Defaults to the EOL detected from the source. */
|
|
94
|
+
endOfLineCharacter?: '\n' | '\r\n';
|
|
95
|
+
/** If `true`, remove all comment lines from the output. Default: `false`. */
|
|
96
|
+
removeComments?: boolean;
|
|
97
|
+
/** If `true`, remove all blank lines from the output. Default: `false`. */
|
|
98
|
+
removeBlankLines?: boolean;
|
|
99
|
+
/** If `true`, strip leading whitespace from all property and comment lines. Default: `false`. */
|
|
100
|
+
removeLeadingWhitespace?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* If `true`, keep only the last occurrence of each duplicate key (Java's last-wins
|
|
103
|
+
* semantics). Earlier occurrences and their leading comment/blank line nodes are
|
|
104
|
+
* removed from the output. Set `deduplicateKeysKeepLeadingNodes` to `true` to
|
|
105
|
+
* preserve the leading nodes. Default: `false`.
|
|
106
|
+
*/
|
|
107
|
+
deduplicateKeys?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* When `deduplicateKeys` is `true`, controls whether comment and blank line nodes
|
|
110
|
+
* preceding removed duplicates are preserved (`true`) or also removed (`false`).
|
|
111
|
+
* Default: `false` (leading nodes are removed along with the duplicate).
|
|
112
|
+
*/
|
|
113
|
+
deduplicateKeysKeepLeadingNodes?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Standardize the separator character across all properties. When set, every
|
|
116
|
+
* property is rewritten to use this separator. Original separators are preserved
|
|
117
|
+
* if not set. Use `' '` for whitespace-only separators (no `=` or `:`).
|
|
118
|
+
*/
|
|
119
|
+
separatorChar?: '=' | ':' | ' ';
|
|
120
|
+
/**
|
|
121
|
+
* Whitespace to place before the separator character (e.g. `' '` for `key = value`,
|
|
122
|
+
* `''` for `key=value`). When not set, each property's original leading whitespace
|
|
123
|
+
* is preserved.
|
|
124
|
+
*/
|
|
125
|
+
separatorLeading?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Whitespace to place after the separator character (e.g. `' '` for `key = value`,
|
|
128
|
+
* `''` for `key=value`). When not set, each property's original trailing whitespace
|
|
129
|
+
* is preserved.
|
|
130
|
+
*/
|
|
131
|
+
separatorTrailing?: string;
|
|
132
|
+
/**
|
|
133
|
+
* If `true`, re-escape all non-ASCII characters as `\\uXXXX` sequences. Useful for
|
|
134
|
+
* producing ISO-8859-1 compatible output. Default: `false` (preserves original encoding).
|
|
135
|
+
*/
|
|
136
|
+
escapeUnicode?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* If `true`, collapse multiline keys and values (joined via `\\` line continuations)
|
|
139
|
+
* into single lines. Default: `false` (preserves original line structure).
|
|
140
|
+
*/
|
|
141
|
+
collapseMultiline?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Wrap keys at this character width using `\\` line continuations. Only applies to
|
|
144
|
+
* keys longer than the specified width. `\\uXXXX` sequences are never split across
|
|
145
|
+
* lines. `undefined` = no wrapping.
|
|
146
|
+
*/
|
|
147
|
+
wrapKeysAt?: number;
|
|
148
|
+
/**
|
|
149
|
+
* Wrap values at this character width using `\\` line continuations. Only applies to
|
|
150
|
+
* values longer than the specified width. `\\uXXXX` sequences are never split across
|
|
151
|
+
* lines. `undefined` = no wrapping.
|
|
152
|
+
*/
|
|
153
|
+
wrapValuesAt?: number;
|
|
154
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"PropertiesNodeType",{enumerable:!0,get:function(){return PropertiesNodeType}});var PropertiesNodeType={PROPERTY:"property",COMMENT:"comment",BLANK:"blank"};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NormalizeOptions, PropertiesNode } from './nodes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Format a set of property nodes into normalized output.
|
|
4
|
+
*
|
|
5
|
+
* @param nodes - All nodes from the parsed document.
|
|
6
|
+
* @param hasBom - Whether the original content had a BOM.
|
|
7
|
+
* @param eolCharacter - The detected EOL character.
|
|
8
|
+
* @param options - Normalization options.
|
|
9
|
+
*
|
|
10
|
+
* @returns The normalized `.properties` file content.
|
|
11
|
+
*/
|
|
12
|
+
export declare const formatNormalized: (nodes: PropertiesNode[], hasBom: boolean, eolCharacter: string, options: NormalizeOptions) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"formatNormalized",{enumerable:!0,get:function(){return formatNormalized}});var _index=require("../escape/index.js"),BOM="\ufeff",wrapAtWidth=function(e,a){if(e.length<=a)return e;for(var r=[],i=0,t=e.length;i<t;){var o=Math.min(i+a,t);if(o<t)for(var n=0;n<6&&o-n>i;n++){var p=o-n;if(p+5<=t&&"\\"===e[p]&&"u"===e[p+1]){o=p;break}}r.push(e.slice(i,o)),i=o}return r.join("\\\n ")},rebuildPropertyLine=function(e,a){var r,i,t,o,n,p=!0===a.escapeUnicode,s=a.removeLeadingWhitespace?"":e.leadingWhitespace,d=p?(0,_index.escapeKey)(e.key,!0):e.escapedKey,c=null!==(r=a.separatorLeading)&&void 0!==r?r:e.separatorLeading,l=null!==(i=a.separatorTrailing)&&void 0!==i?i:e.separatorTrailing;void 0!==a.separatorChar?(n=" "===a.separatorChar?"":a.separatorChar," "===a.separatorChar&&(c=null!==(t=a.separatorLeading)&&void 0!==t?t:" ")):n=null!==(o=e.separatorChar)&&void 0!==o?o:"";var u=p?(0,_index.escapeValue)(e.value,!0):e.escapedValue;return void 0!==a.wrapKeysAt&&a.wrapKeysAt>0&&(d=wrapAtWidth(d,a.wrapKeysAt)),void 0!==a.wrapValuesAt&&a.wrapValuesAt>0&&(u=wrapAtWidth(u,a.wrapValuesAt)),"".concat(s).concat(d).concat(c).concat(n).concat(l).concat(u)},formatNormalized=function(e,a,r,i){var t,o,n=null!==(t=i.endOfLineCharacter)&&void 0!==t?t:r,p=void 0!==i.separatorChar||void 0!==i.separatorLeading||void 0!==i.separatorTrailing||!0===i.escapeUnicode||!0===i.collapseMultiline||void 0!==i.wrapKeysAt||void 0!==i.wrapValuesAt||!0===i.removeLeadingWhitespace;if(i.deduplicateKeys){for(var s={},d=[],c=e.length-1;c>=0;c--){var l=e[c];"property"===l.type&&(s[l.key]?d.push(c):s[l.key]=!0)}o={};for(var u=0;u<d.length;u++){var v=d[u];if(o[v]=!0,!i.deduplicateKeysKeepLeadingNodes)for(var f=v-1;f>=0&&"property"!==e[f].type;f--)o[f]=!0}}for(var h=[],y=0;y<e.length;y++)if(!(null==o?void 0:o[y])){var g=e[y];switch(g.type){case"comment":if(i.removeComments)continue;h.push(i.removeLeadingWhitespace?"".concat(g.delimiter).concat(g.body):g.rawLine);break;case"blank":if(i.removeBlankLines)continue;h.push(g.rawLine);break;case"property":p?h.push(rebuildPropertyLine(g,i)):h.push(g.rawLines.join(n))}}return(a?BOM:"")+h.join(n)};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PropertiesNode } from './nodes.js';
|
|
2
|
+
/** Result of parsing a `.properties` file. */
|
|
3
|
+
export type ParseResult = {
|
|
4
|
+
/** Whether the content starts with a BOM character. */
|
|
5
|
+
hasBom: boolean;
|
|
6
|
+
/** The detected end-of-line character sequence. */
|
|
7
|
+
eolCharacter: string;
|
|
8
|
+
/** All parsed nodes in file order. */
|
|
9
|
+
nodes: PropertiesNode[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Parse a `.properties` file into a lossless sequence of nodes.
|
|
13
|
+
*
|
|
14
|
+
* Every element in the file — properties, comments, and blank lines — is
|
|
15
|
+
* preserved in order. Duplicate keys are all retained. The original content
|
|
16
|
+
* can be reconstructed exactly by joining node raw lines with the EOL
|
|
17
|
+
* character.
|
|
18
|
+
*
|
|
19
|
+
* @param content - The content of a `.properties` file.
|
|
20
|
+
*
|
|
21
|
+
* @returns The parse result with BOM info, detected EOL, and ordered nodes.
|
|
22
|
+
*/
|
|
23
|
+
export declare const parseDocument: (content: string | Buffer) => ParseResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"parseDocument",{enumerable:!0,get:function(){return parseDocument}});var _characters=require("../characters.js"),_index=require("../unescape/index.js"),isWhitespace=function(e){return e===_characters.CH_SPACE||e===_characters.CH_TAB||e===_characters.CH_FF},countTrailingBackslashes=function(e,r){for(var a=0,c=r-1;c>=0&&e.charCodeAt(c)===_characters.CH_BACKSLASH;)a++,c--;return a},parseDocument=function(e){var r="string"==typeof e?e:e.toString(),a=r.length,c=0,t=a>0&&r.charCodeAt(0)===_characters.CH_BOM;t&&(c=1);for(var s="\n",i=c;i<a;i++){var n=r.charCodeAt(i);if(n===_characters.CH_CR){s=i+1<a&&r.charCodeAt(i+1)===_characters.CH_LF?"\r\n":"\r";break}if(n===_characters.CH_LF){s="\n";break}}for(var h=(c>0?r.slice(c):r).split(/\r\n|\r|\n/),o=[],l=0,_=h.length;l<_;){for(var C=h[l],p=l+1,u=0,d=C.length;u<d&&isWhitespace(C.charCodeAt(u));)u++;if(u>=d){var v={type:"blank",rawLine:C,lineNumber:p};o.push(v),l++}else{var f=C.charCodeAt(u);if(f!==_characters.CH_HASH&&f!==_characters.CH_BANG){for(var A=[C],H=p,g=u>0?C.slice(0,u):"",L=countTrailingBackslashes(C,d),b=L%2==1;b&&l+1<_;){var m=h[++l];A.push(m);var S=m.length;b=(L=countTrailingBackslashes(m,S))%2==1}var y=l+1,B=b,O=void 0;if(1===A.length){var k=u>0?C.slice(u):C;O=B?k.slice(0,-1):k}else{for(var x=[],W=0;W<A.length;W++){var N=A[W],j=void 0,T=void 0;if(0===W)j=u,T=N.length-1;else{j=0;for(var E=N.length;j<E&&isWhitespace(N.charCodeAt(j));)j++;T=W===A.length-1&&!B?E:E-1}x.push(N.slice(j,T))}O=x.join("")}for(var F=O.length,w=0,D=!1;w<F;){var K=O.charCodeAt(w);if(K!==_characters.CH_BACKSLASH){if(!D&&(K===_characters.CH_EQUALS||K===_characters.CH_COLON||isWhitespace(K)))break;D=!1,w++}else D=!D,w++}var P=O.slice(0,w),Q="",U=void 0,q="",M=w;if(M<F){for(var G=M;M<F&&isWhitespace(O.charCodeAt(M));)M++;if(M<F){var R=O.charCodeAt(M);if(R===_characters.CH_EQUALS||R===_characters.CH_COLON){Q=O.slice(G,M),U=R===_characters.CH_EQUALS?"=":":";for(var V=++M;M<F&&isWhitespace(O.charCodeAt(M));)M++;q=O.slice(V,M)}else Q=O.slice(G,M)}else Q=O.slice(G,M)}var z=O.slice(M),I={type:"property",rawLines:A,leadingWhitespace:g,key:-1!==P.indexOf("\\")?(0,_index.unescapeContent)(P):P,escapedKey:P,separatorLeading:Q,separatorChar:U,separatorTrailing:q,value:-1!==z.indexOf("\\")?(0,_index.unescapeContent)(z):z,escapedValue:z,startingLineNumber:H,endingLineNumber:y};o.push(I),l++}else{var J={type:"comment",rawLine:C,leadingWhitespace:u>0?C.slice(0,u):"",delimiter:f===_characters.CH_HASH?"#":"!",body:C.slice(u+1),lineNumber:p};o.push(J),l++}}}return{hasBom:t,eolCharacter:s,nodes:o}};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { BlankLineNode, CommentNode, KeyCollisions, KeyValuePairObject, NormalizeOptions, PropertiesNode, PropertyNode } from './nodes.js';
|
|
2
|
+
/**
|
|
3
|
+
* A lossless, ordered representation of a `.properties` file.
|
|
4
|
+
*
|
|
5
|
+
* Every element in the file — properties, comments, and blank lines — is
|
|
6
|
+
* preserved in order. Duplicate keys are all retained. The original content
|
|
7
|
+
* can be reconstructed exactly via {@link format}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Properties {
|
|
10
|
+
/** Whether the content started with a BOM character. */
|
|
11
|
+
readonly hasBom: boolean;
|
|
12
|
+
/** The end-of-line character detected from the content. */
|
|
13
|
+
readonly eolCharacter: string;
|
|
14
|
+
/** All nodes in file order. */
|
|
15
|
+
readonly nodes: PropertiesNode[];
|
|
16
|
+
/**
|
|
17
|
+
* Parse a `.properties` file into a lossless node structure.
|
|
18
|
+
*
|
|
19
|
+
* @param content - The content of a `.properties` file (string or Buffer).
|
|
20
|
+
*/
|
|
21
|
+
constructor(content: string | Buffer);
|
|
22
|
+
/**
|
|
23
|
+
* Get all property nodes in file order (including duplicates).
|
|
24
|
+
*
|
|
25
|
+
* @returns An array of all {@link PropertyNode} instances.
|
|
26
|
+
*/
|
|
27
|
+
getProperties(): PropertyNode[];
|
|
28
|
+
/**
|
|
29
|
+
* Get all comment nodes in file order.
|
|
30
|
+
*
|
|
31
|
+
* @returns An array of all {@link CommentNode} instances.
|
|
32
|
+
*/
|
|
33
|
+
getComments(): CommentNode[];
|
|
34
|
+
/**
|
|
35
|
+
* Get all blank line nodes in file order.
|
|
36
|
+
*
|
|
37
|
+
* @returns An array of all {@link BlankLineNode} instances.
|
|
38
|
+
*/
|
|
39
|
+
getBlankLines(): BlankLineNode[];
|
|
40
|
+
/**
|
|
41
|
+
* Get the effective key-value map (last-wins semantics for duplicate keys).
|
|
42
|
+
*
|
|
43
|
+
* @returns A plain object where each key maps to its last-occurring value.
|
|
44
|
+
*/
|
|
45
|
+
toObject(): KeyValuePairObject;
|
|
46
|
+
/**
|
|
47
|
+
* Get all property nodes for a given key (all occurrences, in file order).
|
|
48
|
+
*
|
|
49
|
+
* @param key - The unescaped key to search for.
|
|
50
|
+
*
|
|
51
|
+
* @returns An array of matching {@link PropertyNode} instances (empty if not found).
|
|
52
|
+
*/
|
|
53
|
+
getPropertyNodes(key: string): PropertyNode[];
|
|
54
|
+
/**
|
|
55
|
+
* Get the effective property node for a given key (last occurrence).
|
|
56
|
+
*
|
|
57
|
+
* @param key - The unescaped key to search for.
|
|
58
|
+
*
|
|
59
|
+
* @returns The last {@link PropertyNode} with this key, or `undefined`.
|
|
60
|
+
*/
|
|
61
|
+
getEffectiveProperty(key: string): PropertyNode | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Get keys that appear more than once, with all their property nodes.
|
|
64
|
+
*
|
|
65
|
+
* @returns An array of {@link KeyCollisions} for duplicate keys.
|
|
66
|
+
*/
|
|
67
|
+
getKeyCollisions(): KeyCollisions[];
|
|
68
|
+
/**
|
|
69
|
+
* Get comment and blank line nodes immediately preceding a property.
|
|
70
|
+
*
|
|
71
|
+
* Walks backward from the last occurrence of the given key, collecting
|
|
72
|
+
* comment and blank line nodes until reaching another property or the
|
|
73
|
+
* start of the file.
|
|
74
|
+
*
|
|
75
|
+
* @param key - The unescaped key to find leading nodes for.
|
|
76
|
+
*
|
|
77
|
+
* @returns An array of preceding {@link CommentNode} and {@link BlankLineNode} instances.
|
|
78
|
+
*/
|
|
79
|
+
getLeadingNodes(key: string): (CommentNode | BlankLineNode)[];
|
|
80
|
+
/**
|
|
81
|
+
* Format the `.properties` content as a string.
|
|
82
|
+
*
|
|
83
|
+
* Without options, produces an exact lossless reconstruction of the original
|
|
84
|
+
* content. With options, produces normalized output — standardize separators,
|
|
85
|
+
* remove comments, deduplicate keys, and more.
|
|
86
|
+
*
|
|
87
|
+
* @param options - Optional normalization options. When omitted, the output
|
|
88
|
+
* is a lossless round-trip of the original content.
|
|
89
|
+
*
|
|
90
|
+
* @returns The formatted `.properties` file content.
|
|
91
|
+
*/
|
|
92
|
+
format(options?: NormalizeOptions): string;
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Properties",{enumerable:!0,get:function(){return Properties}});var _normalize=require("./normalize.js"),_parse=require("./parse.js");function _instanceof(e,r){return null!=r&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}function _class_call_check(e,r){if(!_instanceof(e,r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _create_class(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),e}var BOM="\ufeff",Properties=function(){function e(r){_class_call_check(this,e);var t=(0,_parse.parseDocument)(r);this.hasBom=t.hasBom,this.eolCharacter=t.eolCharacter,this.nodes=t.nodes}return _create_class(e,[{key:"getProperties",value:function(){return this.nodes.filter(function(e){return"property"===e.type})}},{key:"getComments",value:function(){return this.nodes.filter(function(e){return"comment"===e.type})}},{key:"getBlankLines",value:function(){return this.nodes.filter(function(e){return"blank"===e.type})}},{key:"toObject",value:function(){for(var e={},r=0,t=this.nodes;r<t.length;r++){var n=t[r];"property"===n.type&&(e[n.key]=n.value)}return e}},{key:"getPropertyNodes",value:function(e){return this.nodes.filter(function(r){return"property"===r.type&&r.key===e})}},{key:"getEffectiveProperty",value:function(e){for(var r=this.nodes.length-1;r>=0;r--){var t=this.nodes[r];if("property"===t.type&&t.key===e)return t}}},{key:"getKeyCollisions",value:function(){for(var e={},r=0,t=this.nodes;r<t.length;r++){var n=t[r];if("property"===n.type){var o=e[n.key];void 0===o?e[n.key]=[n]:o.push(n)}}for(var i=[],s=0,a=Object.keys(e);s<a.length;s++){var u=a[s],f=e[u];void 0!==f&&f.length>1&&i.push({key:u,nodes:f})}return i}},{key:"getLeadingNodes",value:function(e){for(var r=-1,t=this.nodes.length-1;t>=0;t--){var n=this.nodes[t];if("property"===n.type&&n.key===e){r=t;break}}if(r<=0)return[];for(var o=[],i=r-1;i>=0;i--){var s=this.nodes[i];if("property"===s.type)break;o.unshift(s)}return o}},{key:"format",value:function(e){if(!e){for(var r=this.eolCharacter,t=[],n=0,o=this.nodes;n<o.length;n++){var i=o[n];"property"===i.type?t.push(i.rawLines.join(r)):t.push(i.rawLine)}return(this.hasBom?BOM:"")+t.join(r)}return(0,_normalize.formatNormalized)(this.nodes,this.hasBom,this.eolCharacter,e)}}]),e}();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tries to unescape the content from either key or value of a property.
|
|
3
|
+
*
|
|
4
|
+
* Uses a single-pass, segment-based approach with `charCodeAt()` instead of
|
|
5
|
+
* regex. Scans for backslashes, flushes literal text in bulk via `slice()`,
|
|
6
|
+
* and only builds new characters for actual escape sequences.
|
|
7
|
+
*
|
|
8
|
+
* @param content - The content to unescape.
|
|
9
|
+
*
|
|
10
|
+
* @returns The unescaped content.
|
|
11
|
+
*
|
|
12
|
+
* @throws Error if malformed escaped unicode characters are present.
|
|
13
|
+
*/
|
|
14
|
+
export declare const unescapeContent: (content: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"unescapeContent",{enumerable:!0,get:function(){return unescapeContent}});var _characters=require("../characters.js"),hexValue=function(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1},unescapeContent=function(e){if(-1===e.indexOf("\\"))return e;for(var r=e.length,a="",c=0,t=0;t<r;)if(e.charCodeAt(t)===_characters.CH_BACKSLASH){if(t>c&&(a+=e.slice(c,t)),++t>=r){a+="\\",c=t;break}switch(e.charCodeAt(t)){case _characters.CH_LOWER_N:a+="\n",t++;break;case _characters.CH_LOWER_T:a+="\t",t++;break;case _characters.CH_LOWER_R:a+="\r",t++;break;case _characters.CH_LOWER_F:a+="\f",t++;break;case _characters.CH_LOWER_U:if(t+4>=r)throw new Error("malformed escaped unicode characters '".concat(e.slice(t-1,t+5),"'"));var n=hexValue(e.charCodeAt(t+1)),s=hexValue(e.charCodeAt(t+2)),o=hexValue(e.charCodeAt(t+3)),h=hexValue(e.charCodeAt(t+4));if(n<0||s<0||o<0||h<0)throw new Error("malformed escaped unicode characters '".concat(e.slice(t-1,t+5),"'"));a+=String.fromCharCode(n<<12|s<<8|o<<4|h),t+=5;break;default:a+=e.charAt(t),t++}c=t}else t++;return c<r&&(a+=e.slice(c,r)),a};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BunPlugin } from 'bun';
|
|
2
|
+
/**
|
|
3
|
+
* Bun plugin for `.properties` files. Works with both `Bun.plugin` (runtime) and `Bun.build`
|
|
4
|
+
* (build-time).
|
|
5
|
+
*/
|
|
6
|
+
declare const bunPlugin: BunPlugin;
|
|
7
|
+
export default bunPlugin;
|
|
8
|
+
|
|
9
|
+
// Enables type recognition for direct `.properties` file imports.
|
|
10
|
+
import '../properties-file.d.ts'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync}from"node:fs";import{getProperties}from"../index.js";var bunPlugin={name:"properties-file",setup:function(e){e.onLoad({filter:/\.properties$/},function(e){var r=e.path;return{exports:{properties:getProperties(readFileSync(r,"utf8"))},loader:"object"}})}};export default bunPlugin;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Plugin } from 'esbuild';
|
|
2
|
+
/**
|
|
3
|
+
* esbuild plugin for `.properties` files.
|
|
4
|
+
*
|
|
5
|
+
* @returns An esbuild plugin that transforms `.properties` imports into JavaScript modules.
|
|
6
|
+
*/
|
|
7
|
+
declare const esbuildPlugin: () => Plugin;
|
|
8
|
+
export default esbuildPlugin;
|
|
9
|
+
|
|
10
|
+
// Enables type recognition for direct `.properties` file imports.
|
|
11
|
+
import '../properties-file.d.ts'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync}from"node:fs";import{getProperties}from"../index.js";var esbuildPlugin=function(){return{name:"properties-file",setup:function(e){e.onLoad({filter:/\.properties$/},function(e){var r=e.path;return{contents:"export const properties = ".concat(JSON.stringify(getProperties(readFileSync(r,"utf8"))),";"),loader:"js"}})}}};export default esbuildPlugin;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Plugin } from 'rollup';
|
|
2
|
+
/**
|
|
3
|
+
* Rollup plugin for `.properties` files. Also compatible with Vite and Rolldown.
|
|
4
|
+
*
|
|
5
|
+
* @returns A Rollup plugin that transforms `.properties` imports into JavaScript modules.
|
|
6
|
+
*/
|
|
7
|
+
declare const rollupPlugin: () => Plugin;
|
|
8
|
+
export default rollupPlugin;
|
|
9
|
+
|
|
10
|
+
// Enables type recognition for direct `.properties` file imports.
|
|
11
|
+
import '../properties-file.d.ts'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getProperties}from"../index.js";var PROPERTIES_EXTENSION=".properties",rollupPlugin=function(){return{name:"properties-file",transform:function(e,r){return-1===r.indexOf(PROPERTIES_EXTENSION,r.length-PROPERTIES_EXTENSION.length)?null:{code:"export const properties = ".concat(JSON.stringify(getProperties(e)),";"),map:null}}}};export default rollupPlugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webpack file loader for `.properties` files. Also compatible with Rspack.
|
|
3
|
+
*
|
|
4
|
+
* @param content - The content of a `.properties` file.
|
|
5
|
+
*
|
|
6
|
+
* @returns A CommonJS module string exporting the parsed key-value pairs.
|
|
7
|
+
*/
|
|
8
|
+
declare const webpackLoader: (content: string) => string;
|
|
9
|
+
export default webpackLoader;
|
|
10
|
+
|
|
11
|
+
// Enables type recognition for direct `.properties` file imports.
|
|
12
|
+
import '../properties-file.d.ts'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getProperties}from"../index.js";var webpackLoader=function(e){return"exports.properties = ".concat(JSON.stringify(getProperties(e)),";")};export default webpackLoader;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Tab character code. */
|
|
2
|
+
export declare const CH_TAB = 9;
|
|
3
|
+
/** Line feed character code. */
|
|
4
|
+
export declare const CH_LF = 10;
|
|
5
|
+
/** Form feed character code. */
|
|
6
|
+
export declare const CH_FF = 12;
|
|
7
|
+
/** Carriage return character code. */
|
|
8
|
+
export declare const CH_CR = 13;
|
|
9
|
+
/** Space character code. */
|
|
10
|
+
export declare const CH_SPACE = 32;
|
|
11
|
+
/** Exclamation mark character code (comment delimiter). */
|
|
12
|
+
export declare const CH_BANG = 33;
|
|
13
|
+
/** Hash character code (comment delimiter). */
|
|
14
|
+
export declare const CH_HASH = 35;
|
|
15
|
+
/** Colon character code (separator). */
|
|
16
|
+
export declare const CH_COLON = 58;
|
|
17
|
+
/** Equals character code (separator). */
|
|
18
|
+
export declare const CH_EQUALS = 61;
|
|
19
|
+
/** Backslash character code (escape / continuation). */
|
|
20
|
+
export declare const CH_BACKSLASH = 92;
|
|
21
|
+
/** Lowercase 'f' character code (formfeed escape). */
|
|
22
|
+
export declare const CH_LOWER_F = 102;
|
|
23
|
+
/** Lowercase 'n' character code (newline escape). */
|
|
24
|
+
export declare const CH_LOWER_N = 110;
|
|
25
|
+
/** Lowercase 'r' character code (carriage return escape). */
|
|
26
|
+
export declare const CH_LOWER_R = 114;
|
|
27
|
+
/** Lowercase 't' character code (tab escape). */
|
|
28
|
+
export declare const CH_LOWER_T = 116;
|
|
29
|
+
/** Lowercase 'u' character code (unicode escape). */
|
|
30
|
+
export declare const CH_LOWER_U = 117;
|
|
31
|
+
/** Byte Order Mark character code. */
|
|
32
|
+
export declare const CH_BOM = 65279;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var CH_TAB=9;export var CH_LF=10;export var CH_FF=12;export var CH_CR=13;export var CH_SPACE=32;export var CH_BANG=33;export var CH_HASH=35;export var CH_COLON=58;export var CH_EQUALS=61;export var CH_BACKSLASH=92;export var CH_LOWER_F=102;export var CH_LOWER_N=110;export var CH_LOWER_R=114;export var CH_LOWER_T=116;export var CH_LOWER_U=117;export var CH_BOM=65279;
|