Compare commits

...

3 Commits

Author SHA1 Message Date
f8714aab11 Docker needs access to the git repo, if only as read-only. 2024-02-21 08:20:26 -08:00
6e707964b4 Lage won't run without at least read-only access to the git repo. 2024-02-20 10:21:23 -08:00
ed30ae434d web: move authentik to a sub-repository
This commit moves the build of the web into a sub-repository and refactors the build instructions to
understand that move.  The simple result at this time will be just a move and a re-arrangement of
the build paths so that the final product is still deposited in the `./dist` folder.

Only a few "functional" changes have been made:

- The core package has been renamed '@goauthentik/authentik' to distinguish itself from the root
  package name '@goauthentik/web'.
- The codespell paths have been updated
- The path to the imported markdown documentation has been updated.
- TSConfig.json has been split into a "base" and "build" pair. This is necessary because our future
  builds will use a slightly different configuration from our linters, as the former do not need the
  typing information (their job is to strip it away, leaving us with pure JavaScript), and the
  latter very definitely need it to make our IDE's work correctly.
- Rollup.config.js has also been split into a "base" and "build" pair. The base has been slightly
  refactored, with heavily concretized paths for the project ROOT and project DIST folders. This
  informs the moved authentik project where to put the built release.

The NPM -> Lage relationship was done mechanicall: I copied our targets from the existing
package.json into lage, then used some regex magic to tell lage "call all these targets in our
packages," of which we have exactly ONE right now.

I also had to fix yet another xliff consistency error.  *Sigh*.
2024-02-19 14:45:54 -08:00
524 changed files with 20902 additions and 478 deletions

View File

@ -6,7 +6,6 @@ build/**
build_docs/**
*Dockerfile
blueprints/local
.git
!gen-ts-api/node_modules
!gen-ts-api/dist/**
!gen-go-api/

View File

@ -27,6 +27,7 @@ WORKDIR /work/web
RUN --mount=type=bind,target=/work/web/package.json,src=./web/package.json \
--mount=type=bind,target=/work/web/package-lock.json,src=./web/package-lock.json \
--mount=type=bind,target=/work/.git,src=./.git,readonly \
--mount=type=cache,id=npm-web,sharing=shared,target=/root/.npm \
npm ci --include=dev

33
web/lage.config.js Normal file
View File

@ -0,0 +1,33 @@
module.exports = {
// Basic syntax: just run these tasks all the packages. There is only one package at the moment.
pipeline: {
"extract-locales": ["^extract-locales"],
"build-locales": ["^build-locales"],
"build-locales:build": ["^build-locales:build"],
"build-locales:repair": ["^build-locales:repair"],
"rollup:build": ["^rollup:build"],
"rollup:build-proxy": ["^rollup:build-proxy"],
"rollup:watch": ["^rollup:watch"],
"build": ["^build"],
"build-proxy": ["^build-proxy"],
"watch": ["^watch"],
"lint": ["^lint"],
"lint:precommit": ["^lint:precommit"],
"lint:spelling": ["^lint:spelling"],
"lit-analyse": ["^lit-analyse"],
"precommit": ["^precommit"],
"prequick": ["^prequick"],
"prettier-check": ["^prettier-check"],
"prettier": ["^prettier"],
"pseudolocalize:build-extract-script": ["^pseudolocalize:build-extract-script"],
"pseudolocalize:extract": ["^pseudolocalize:extract"],
"pseudolocalize": ["^pseudolocalize"],
"tsc:execute": ["^tsc:execute"],
"tsc": ["^tsc"],
"storybook": ["^storybook"],
"storybook:build": ["^storybook:build"],
"storybook:build-import-map": ["^storybook:build-import-map"],
"storybook:build-import-map-script": ["^storybook:build-import-map-script"],
"storybook:run-import-map-script": ["^storybook:run-import-map-script"],
},
};

1073
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,132 +4,38 @@
"private": true,
"license": "MIT",
"scripts": {
"extract-locales": "lit-localize extract",
"build-locales": "run-s build-locales:build",
"build-locales:build": "lit-localize build",
"build-locales:repair": "prettier --write ./src/locale-codes.ts",
"rollup:build": "cross-env NODE_OPTIONS='--max_old_space_size=8192' rollup -c ./rollup.config.mjs",
"rollup:build-proxy": "cross-env NODE_OPTIONS='--max_old_space_size=8192' rollup -c ./rollup.proxy.mjs",
"rollup:watch": "cross-env NODE_OPTIONS='--max_old_space_size=8192' rollup -c -w",
"build": "run-s build-locales rollup:build",
"build-proxy": "run-s build-locales rollup:build-proxy",
"watch": "run-s build-locales rollup:watch",
"lint": "eslint . --max-warnings 0 --fix",
"lint:precommit": "eslint --max-warnings 0 --config ./.eslintrc.precommit.json $(git status --porcelain . | grep '^[M?][M?]' | cut -c8- | grep -E '\\.(ts|js|tsx|jsx)$') ",
"lint:spelling": "codespell -D - -D ../.github/codespell-dictionary.txt -I ../.github/codespell-words.txt -S './src/locales/**' ./src -s",
"lit-analyse": "lit-analyzer src",
"precommit": "run-s tsc lit-analyse lint:precommit lint:spelling prettier",
"prequick": "run-s tsc:execute lit-analyse lint:precommit lint:spelling",
"prettier-check": "prettier --check .",
"prettier": "prettier --write .",
"pseudolocalize:build-extract-script": "cd scripts && tsc --esModuleInterop --module es2020 --moduleResolution 'node' pseudolocalize.ts && mv pseudolocalize.js pseudolocalize.mjs",
"pseudolocalize:extract": "node scripts/pseudolocalize.mjs",
"pseudolocalize": "run-s pseudolocalize:build-extract-script pseudolocalize:extract",
"tsc:execute": "tsc --noEmit -p .",
"tsc": "run-s build-locales tsc:execute",
"storybook": "storybook dev -p 6006",
"storybook:build": "cross-env NODE_OPTIONS='--max_old_space_size=8192' storybook build",
"storybook:build-import-map": "run-s storybook:build-import-map-script storybook:run-import-map-script",
"storybook:build-import-map-script": "cd scripts && tsc --esModuleInterop --module es2020 --target es2020 --moduleResolution 'node' build-storybook-import-maps.ts && mv build-storybook-import-maps.js build-storybook-import-maps.mjs",
"storybook:run-import-map-script": "node scripts/build-storybook-import-maps.mjs"
"extract-locales": "lage extract-locales",
"build-locales": "lage build-locales",
"build-locales:build": "lage build-locales:build",
"build-locales:repair": "lage build-locales:repair",
"rollup:build": "lage rollup:build",
"rollup:build-proxy": "lage rollup:build-proxy",
"rollup:watch": "lage rollup:watch",
"build": "lage build",
"build-proxy": "lage build-proxy",
"watch": "lage watch",
"lint": "lage lint",
"lint:precommit": "lage lint:precommit",
"lint:spelling": "lage lint:spelling",
"lit-analyse": "lage lit-analyse",
"precommit": "lage precommit",
"prequick": "lage prequick",
"prettier-check": "lage prettier-check",
"prettier": "lage prettier",
"pseudolocalize:build-extract-script": "lage pseudolocalize:build-extract-script",
"pseudolocalize:extract": "lage pseudolocalize:extract",
"pseudolocalize": "lage pseudolocalize",
"tsc:execute": "lage tsc:execute",
"tsc": "lage tsc",
"storybook": "lage storybook",
"storybook:build": "lage storybook:build",
"storybook:build-import-map": "lage storybook:build-import-map",
"storybook:build-import-map-script": "lage storybook:build-import-map-script",
"storybook:run-import-map-script": "lage storybook:run-import-map-script"
},
"dependencies": {
"@codemirror/lang-html": "^6.4.8",
"@codemirror/lang-javascript": "^6.2.1",
"@codemirror/lang-python": "^6.1.4",
"@codemirror/lang-xml": "^6.0.2",
"@codemirror/legacy-modes": "^6.3.3",
"@codemirror/theme-one-dark": "^6.1.2",
"@formatjs/intl-listformat": "^7.5.5",
"@fortawesome/fontawesome-free": "^6.5.1",
"@goauthentik/api": "^2023.10.7-1707933453",
"@lit-labs/context": "^0.4.0",
"@lit-labs/task": "^3.1.0",
"@lit/localize": "^0.11.4",
"@open-wc/lit-helpers": "^0.6.0",
"@patternfly/elements": "^2.4.0",
"@patternfly/patternfly": "^4.224.2",
"@sentry/browser": "^7.101.1",
"@webcomponents/webcomponentsjs": "^2.8.0",
"base64-js": "^1.5.1",
"chart.js": "^4.4.1",
"chartjs-adapter-moment": "^1.0.1",
"codemirror": "^6.0.1",
"construct-style-sheets-polyfill": "^3.1.0",
"core-js": "^3.36.0",
"country-flag-icons": "^1.5.9",
"fuse.js": "^7.0.0",
"guacamole-common-js": "^1.5.0",
"lit": "^2.8.0",
"mermaid": "^10.8.0",
"rapidoc": "^9.3.4",
"style-mod": "^4.1.0",
"webcomponent-qr-code": "^1.2.0",
"yaml": "^2.3.4"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.23.9",
"@babel/plugin-transform-private-methods": "^7.23.3",
"@babel/plugin-transform-private-property-in-object": "^7.23.4",
"@babel/plugin-transform-runtime": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@babel/preset-typescript": "^7.23.3",
"@hcaptcha/types": "^1.0.3",
"@jackfranklin/rollup-plugin-markdown": "^0.4.0",
"@jeysal/storybook-addon-css-user-preferences": "^0.2.0",
"@lit/localize-tools": "^0.7.2",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@spotlightjs/spotlight": "^1.2.12",
"@storybook/addon-essentials": "^7.6.16",
"@storybook/addon-links": "^7.6.16",
"@storybook/api": "^7.6.16",
"@storybook/blocks": "^7.6.4",
"@storybook/manager-api": "^7.6.16",
"@storybook/web-components": "^7.6.16",
"@storybook/web-components-vite": "^7.6.16",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/chart.js": "^2.9.41",
"@types/codemirror": "5.60.15",
"@types/grecaptcha": "^3.0.7",
"@types/guacamole-common-js": "1.5.2",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-tsconfig-paths": "^1.0.3",
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-custom-elements": "0.0.8",
"eslint-plugin-lit": "^1.11.0",
"eslint-plugin-sonarjs": "^0.24.0",
"eslint-plugin-storybook": "^0.8.0",
"github-slugger": "^2.0.0",
"lit-analyzer": "^2.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"pseudolocale": "^2.0.0",
"pyright": "=1.1.338",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^4.12.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-cssimport": "^1.0.3",
"rollup-plugin-modify": "^3.0.0",
"rollup-plugin-postcss-lit": "^2.1.0",
"storybook": "^7.6.16",
"storybook-addon-mock": "^4.3.0",
"ts-lit-plugin": "^2.0.2",
"tslib": "^2.6.2",
"turnstile-types": "^1.2.0",
"typescript": "^5.3.3",
"vite-tsconfig-paths": "^4.3.1"
"@manypkg/cli": "^0.21.1",
"lage": "^2.7.9"
},
"optionalDependencies": {
"@esbuild/darwin-arm64": "^0.20.0",
@ -138,5 +44,8 @@
},
"engines": {
"node": ">=20"
}
},
"workspaces": [
"packages/authentik"
]
}

View File

@ -0,0 +1,37 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:lit/recommended",
"plugin:custom-elements/recommended",
"plugin:storybook/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module",
"project": true
},
"plugins": ["@typescript-eslint", "lit", "custom-elements"],
"ignorePatterns": ["authentik-live-tests/**"],
"rules": {
"indent": "off",
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double", { "avoidEscape": true }],
"semi": ["error", "always"],
"@typescript-eslint/ban-ts-comment": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
}
}

19299
web/packages/authentik/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,142 @@
{
"name": "@goauthentik/authentik",
"version": "0.0.0",
"private": true,
"license": "MIT",
"scripts": {
"extract-locales": "lit-localize extract",
"build-locales": "run-s build-locales:build",
"build-locales:build": "lit-localize build",
"build-locales:repair": "prettier --write ./src/locale-codes.ts",
"rollup:build": "cross-env NODE_OPTIONS='--max_old_space_size=8192' rollup -c ./rollup.config.mjs",
"rollup:build-proxy": "cross-env NODE_OPTIONS='--max_old_space_size=8192' rollup -c ./rollup.proxy.mjs",
"rollup:watch": "cross-env NODE_OPTIONS='--max_old_space_size=8192' rollup -c -w",
"build": "run-s build-locales rollup:build",
"build-proxy": "run-s build-locales rollup:build-proxy",
"watch": "run-s build-locales rollup:watch",
"lint": "eslint . --max-warnings 0 --fix",
"lint:precommit": "eslint --max-warnings 0 --config ./.eslintrc.precommit.json $(git status --porcelain . | grep '^[M?][M?]' | cut -c8- | grep -E '\\.(ts|js|tsx|jsx)$') ",
"lint:spelling": "codespell -D - -D ../../../.github/codespell-dictionary.txt -I ../../../.github/codespell-words.txt -S './src/locales/**' ./src -s",
"lit-analyse": "lit-analyzer src",
"precommit": "run-s tsc lit-analyse lint:precommit lint:spelling prettier",
"prequick": "run-s tsc:execute lit-analyse lint:precommit lint:spelling",
"prettier-check": "prettier --check .",
"prettier": "prettier --write .",
"pseudolocalize:build-extract-script": "cd scripts && tsc --esModuleInterop --module es2020 --moduleResolution 'node' pseudolocalize.ts && mv pseudolocalize.js pseudolocalize.mjs",
"pseudolocalize:extract": "node scripts/pseudolocalize.mjs",
"pseudolocalize": "run-s pseudolocalize:build-extract-script pseudolocalize:extract",
"tsc:execute": "tsc --noEmit -p .",
"tsc": "run-s build-locales tsc:execute",
"storybook": "storybook dev -p 6006",
"storybook:build": "cross-env NODE_OPTIONS='--max_old_space_size=8192' storybook build",
"storybook:build-import-map": "run-s storybook:build-import-map-script storybook:run-import-map-script",
"storybook:build-import-map-script": "cd scripts && tsc --esModuleInterop --module es2020 --target es2020 --moduleResolution 'node' build-storybook-import-maps.ts && mv build-storybook-import-maps.js build-storybook-import-maps.mjs",
"storybook:run-import-map-script": "node scripts/build-storybook-import-maps.mjs"
},
"dependencies": {
"@codemirror/lang-html": "^6.4.8",
"@codemirror/lang-javascript": "^6.2.1",
"@codemirror/lang-python": "^6.1.4",
"@codemirror/lang-xml": "^6.0.2",
"@codemirror/legacy-modes": "^6.3.3",
"@codemirror/theme-one-dark": "^6.1.2",
"@formatjs/intl-listformat": "^7.5.5",
"@fortawesome/fontawesome-free": "^6.5.1",
"@goauthentik/api": "^2023.10.7-1707933453",
"@lit-labs/context": "^0.4.0",
"@lit-labs/task": "^3.1.0",
"@lit/localize": "^0.11.4",
"@open-wc/lit-helpers": "^0.6.0",
"@patternfly/elements": "^2.4.0",
"@patternfly/patternfly": "^4.224.2",
"@sentry/browser": "^7.101.1",
"@webcomponents/webcomponentsjs": "^2.8.0",
"base64-js": "^1.5.1",
"chart.js": "^4.4.1",
"chartjs-adapter-moment": "^1.0.1",
"codemirror": "^6.0.1",
"construct-style-sheets-polyfill": "^3.1.0",
"core-js": "^3.36.0",
"country-flag-icons": "^1.5.9",
"fuse.js": "^7.0.0",
"guacamole-common-js": "^1.5.0",
"lit": "^2.8.0",
"mermaid": "^10.8.0",
"rapidoc": "^9.3.4",
"style-mod": "^4.1.0",
"webcomponent-qr-code": "^1.2.0",
"yaml": "^2.3.4"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.23.9",
"@babel/plugin-transform-private-methods": "^7.23.3",
"@babel/plugin-transform-private-property-in-object": "^7.23.4",
"@babel/plugin-transform-runtime": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@babel/preset-typescript": "^7.23.3",
"@hcaptcha/types": "^1.0.3",
"@jackfranklin/rollup-plugin-markdown": "^0.4.0",
"@jeysal/storybook-addon-css-user-preferences": "^0.2.0",
"@lit/localize-tools": "^0.7.2",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@spotlightjs/spotlight": "^1.2.12",
"@storybook/addon-essentials": "^7.6.16",
"@storybook/addon-links": "^7.6.16",
"@storybook/api": "^7.6.16",
"@storybook/blocks": "^7.6.4",
"@storybook/manager-api": "^7.6.16",
"@storybook/web-components": "^7.6.16",
"@storybook/web-components-vite": "^7.6.16",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/chart.js": "^2.9.41",
"@types/codemirror": "5.60.15",
"@types/grecaptcha": "^3.0.7",
"@types/guacamole-common-js": "1.5.2",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-tsconfig-paths": "^1.0.3",
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-custom-elements": "0.0.8",
"eslint-plugin-lit": "^1.11.0",
"eslint-plugin-sonarjs": "^0.24.0",
"eslint-plugin-storybook": "^0.8.0",
"github-slugger": "^2.0.0",
"lit-analyzer": "^2.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"pseudolocale": "^2.0.0",
"pyright": "=1.1.338",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^4.12.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-cssimport": "^1.0.3",
"rollup-plugin-modify": "^3.0.0",
"rollup-plugin-postcss-lit": "^2.1.0",
"storybook": "^7.6.16",
"storybook-addon-mock": "^4.3.0",
"ts-lit-plugin": "^2.0.2",
"tslib": "^2.6.2",
"turnstile-types": "^1.2.0",
"typescript": "^5.3.3",
"vite-tsconfig-paths": "^4.3.1"
},
"optionalDependencies": {
"@esbuild/darwin-arm64": "^0.20.0",
"@esbuild/linux-amd64": "^0.18.11",
"@esbuild/linux-arm64": "^0.20.0"
},
"engines": {
"node": ">=20"
}
}

View File

@ -0,0 +1,107 @@
import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import terser from "@rollup/plugin-terser";
import path from "path";
import copy from "rollup-plugin-copy";
import cssimport from "rollup-plugin-cssimport";
import { DIST, defaultOptions, isProdBuild, manualChunks, resources } from "../../rollup.base.mjs";
export const POLY = {
input: "./src/polyfill/poly.ts",
output: [
{
format: "iife",
file: path.join(DIST, "poly.js"),
sourcemap: true,
},
],
cache: true,
plugins: [
cssimport(),
nodeResolve({ browser: true }),
commonjs(),
isProdBuild && terser(),
copy({
targets: [...resources],
copyOnce: false,
}),
].filter((p) => p),
};
export const standalone = ["api-browser", "loading"].map((input) => {
return {
input: `./src/standalone/${input}`,
output: [
{
format: "es",
dir: path.join(DIST, "standalone", input),
sourcemap: true,
manualChunks: manualChunks,
},
],
...defaultOptions,
};
});
export const enterprise = ["rac"].map((input) => {
return {
input: `./src/enterprise/${input}`,
output: [
{
format: "es",
dir: path.join(DIST, "enterprise", input),
sourcemap: true,
manualChunks: manualChunks,
},
],
...defaultOptions,
};
});
export default [
POLY,
// Standalone
...standalone,
// Flow interface
{
input: "./src/flow/FlowInterface.ts",
output: [
{
format: "es",
dir: path.join(DIST, "flow"),
sourcemap: true,
manualChunks: manualChunks,
},
],
...defaultOptions,
},
// Admin interface
{
input: "./src/admin/AdminInterface/AdminInterface.ts",
output: [
{
format: "es",
dir: path.join(DIST, "admin"),
sourcemap: true,
manualChunks: manualChunks,
},
],
...defaultOptions,
},
// User interface
{
input: "./src/user/UserInterface.ts",
output: [
{
format: "es",
dir: path.join(DIST, "user"),
sourcemap: true,
manualChunks: manualChunks,
},
],
...defaultOptions,
},
// Enterprise
...enterprise,
];

View File

@ -0,0 +1,48 @@
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
import { readFileSync } from "fs";
import path from "path";
import pseudolocale from "pseudolocale";
import { fileURLToPath } from "url";
import { makeFormatter } from "@lit/localize-tools/lib/formatters/index.js";
import { sortProgramMessages } from "@lit/localize-tools/lib/messages.js";
import { TransformLitLocalizer } from "@lit/localize-tools/lib/modes/transform.js";
var __dirname = fileURLToPath(new URL(".", import.meta.url));
var pseudoLocale = "pseudo-LOCALE";
var targetLocales = [pseudoLocale];
var baseConfig = JSON.parse(readFileSync(path.join(__dirname, "../lit-localize.json"), "utf-8"));
// Need to make some internal specifications to satisfy the transformer. It doesn't actually matter
// which Localizer we use (transformer or runtime), because all of the functionality we care about
// is in their common parent class, but I had to pick one. Everything else here is just pure
// exploitation of the lit/localize-tools internals.
var config = __assign(__assign({}, baseConfig), { baseDir: path.join(__dirname, ".."), targetLocales: targetLocales, output: __assign(__assign({}, baseConfig), { mode: "transform" }), resolve: function (path) { return path; } });
var pseudoMessagify = function (message) { return ({
name: message.name,
contents: message.contents.map(function (content) {
return typeof content === "string" ? pseudolocale(content, { prepend: "", append: "" }) : content;
}),
}); };
var localizer = new TransformLitLocalizer(config);
var messages = localizer.extractSourceMessages().messages;
var translations = messages.map(pseudoMessagify);
var sorted = sortProgramMessages(__spreadArray([], messages, true));
var formatter = makeFormatter(config);
formatter.writeOutput(sorted, new Map([[pseudoLocale, translations]]));

Some files were not shown because too many files have changed in this diff Show More