From fcc2f8001b4417fe419acf81a4744e14cae263ea Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Thu, 16 Nov 2023 23:45:57 +0100 Subject: [PATCH 1/3] Release/0.8.31 (#105) --- .changeset/config.json | 11 + .github/workflows/build-test.yml | 38 +- .github/workflows/release.yml | 39 +- .npmrc | 2 + CHANGELOG.md | 10 +- README.md | 23 +- docs/osgi-comparison.md | 1 + examples/README.md | 4 - examples/basic-browser-js/.gitignore | 1 + examples/basic-browser-js/README.md | 4 +- examples/basic-browser-js/cp-dependencies.sh | 11 + examples/basic-browser-js/dist/index.html | 6 +- examples/basic-browser-ts/cp-dependencies.sh | 6 +- examples/basic-browser-ts/package-lock.json | 119 +- .../packages/app/src/index.ejs | 2 + .../packages/app/src/index.ts | 2 +- .../packages/app/tsconfig.json | 2 +- .../packages/bundle-a/tsconfig.json | 2 +- .../packages/bundle-a/webpack.config.js | 6 +- .../packages/bundle-b/tsconfig.json | 4 +- examples/browser-clicky-js/.gitignore | 1 + examples/browser-clicky-js/README.md | 4 +- examples/browser-clicky-js/cp-dependencies.sh | 11 + examples/browser-clicky-js/dist/index.html | 6 +- .../.gitignore | 1 + .../README.md | 4 +- .../cp-dependencies.sh | 13 + .../dist/index.html | 10 +- examples/custom-elements-web-js/.gitignore | 1 + examples/custom-elements-web-js/README.md | 4 +- .../custom-elements-web-js/cp-dependencies.sh | 11 + examples/custom-elements-web-js/dist/index.js | 6 +- examples/nodejs-cjs/package-lock.json | 64 +- .../package-lock.json | 129 +- examples/react-systemjs/.prettierrc | 8 - examples/react-systemjs/README.md | 50 - examples/react-systemjs/lerna.json | 14 - examples/react-systemjs/package-lock.json | 8109 ------------ examples/react-systemjs/package.json | 39 - .../react-systemjs/packages/app/package.json | 36 - .../app/repackaged/react-dom-client.tsx | 6 - .../packages/app/repackaged/react-is.tsx | 1 - .../app/repackaged/react-jsx-runtime.tsx | 14 - .../packages/app/rollup.config.mjs | 60 - .../packages/app/rollup/helpers.mjs | 101 - .../react-systemjs/packages/app/serve.json | 6 - .../react-systemjs/packages/app/src/App.tsx | 18 - .../packages/app/src/FallbackComponent.tsx | 21 - .../react-systemjs/packages/app/src/main.tsx | 65 - .../packages/app/src/service.ts | 11 - .../react-systemjs/packages/app/tsconfig.json | 22 - .../packages/component-api/package.json | 23 - .../packages/component-api/rollup.config.js | 26 - .../packages/component-api/src/index.ts | 10 - .../packages/component-api/tsconfig.json | 23 - .../packages/component-one/package.json | 32 - .../packages/component-one/rollup.config.mjs | 37 - .../component-one/src/ComponentOne.tsx | 14 - .../packages/component-one/src/index.tsx | 16 - .../packages/component-one/tsconfig.json | 22 - examples/string-inverter/.gitignore | 3 +- examples/string-inverter/cp-dependencies.sh | 11 + examples/string-inverter/dist/index.html | 4 +- .../tsconfig.base.json | 0 examples/umd-bundle-ts/package-lock.json | 32 +- examples/umd-bundle-ts/tsconfig.json | 2 +- examples/umd-bundle-ts/webpack.config.js | 10 +- lerna.json | 22 - package-lock.json | 10192 ---------------- package.json | 36 +- .../bundle-installer-dom/CHANGELOG.md | 22 +- .../@pandino/bundle-installer-dom/README.md | 1 - .../dts-bundle-generator.config.ts | 17 + .../bundle-installer-dom/package.json | 23 +- .../bundle-installer-dom/rollup.config.js | 20 - .../bundle-installer-dom/src/index.ts | 43 +- .../bundle-installer-dom/tsconfig.json | 22 +- .../bundle-installer-dom/vite.config.ts | 40 + .../bundle-installer-nodejs/CHANGELOG.md | 22 +- .../bundle-installer-nodejs/README.md | 1 - .../dts-bundle-generator.config.ts | 17 + .../bundle-installer-nodejs/package.json | 26 +- .../bundle-installer-nodejs/rollup.config.js | 20 - .../bundle-installer-nodejs/src/activator.ts | 41 +- .../src/installer-service.ts | 25 +- .../bundle-installer-nodejs/tsconfig.json | 22 +- .../bundle-installer-nodejs/vite.config.ts | 47 + .../configuration-management-api/CHANGELOG.md | 22 +- .../configuration-management-api/README.md | 1 - .../dts-bundle-generator.config.ts | 17 + .../configuration-management-api/package.json | 25 +- .../tsconfig.json | 22 +- .../vite.config.ts | 36 + .../configuration-management/CHANGELOG.md | 22 +- .../configuration-management/README.md | 1 - .../dts-bundle-generator.config.ts | 17 + .../configuration-management/package.json | 72 +- .../configuration-management/rollup.config.js | 20 - .../src/__mocks__/mock-bundle-context.ts | 16 +- .../src/__mocks__/mock-bundle.ts | 6 +- .../src/__mocks__/mock-persistence-manager.ts | 4 +- .../src/__mocks__/mock-service-reference.ts | 7 +- .../configuration-manager.test.ts.snap | 41 +- .../configuration-management/src/activator.ts | 93 +- .../src/configuration-admin-impl.ts | 8 +- .../src/configuration-cache.ts | 7 +- .../src/configuration-impl.test.ts | 34 +- .../src/configuration-impl.ts | 7 +- .../src/configuration-manager.test.ts | 18 +- .../src/configuration-manager.ts | 77 +- .../src/helper/targeted-pid.test.ts | 3 +- .../src/helper/targeted-pid.ts | 6 +- .../configuration-management/tsconfig.json | 22 +- .../tsconfig.test.json | 9 - .../configuration-management/vite.config.ts | 40 + packages/@pandino/event-admin/CHANGELOG.md | 22 +- packages/@pandino/event-admin/README.md | 1 - .../dts-bundle-generator.config.ts | 17 + packages/@pandino/event-admin/package.json | 70 +- .../@pandino/event-admin/rollup.config.js | 20 - .../@pandino/event-admin/src/activator.ts | 43 +- .../src/adapters/abstract-adapter.ts | 4 +- .../src/adapters/bundle-event-adapter.test.ts | 11 +- .../src/adapters/bundle-event-adapter.ts | 5 +- .../adapters/framework-event-adapter.test.ts | 11 +- .../src/adapters/framework-event-adapter.ts | 11 +- .../src/adapters/log-event-adapter.ts | 6 +- .../adapters/service-event-adapter.test.ts | 12 +- .../src/adapters/service-event-adapter.ts | 20 +- .../event-admin/src/event-admin-impl.test.ts | 25 +- .../event-admin/src/event-admin-impl.ts | 20 +- .../src/event-handler-registration-info.ts | 5 +- .../event-admin/src/event-impl.test.ts | 1 + .../@pandino/event-admin/src/event-impl.ts | 3 +- .../event-admin/src/matcher/matcher-all.ts | 2 +- .../src/matcher/package-matcher.ts | 2 +- .../src/matcher/sub-package-matcher.ts | 2 +- .../@pandino/event-admin/src/matchers.test.ts | 3 +- packages/@pandino/event-admin/src/matchers.ts | 3 +- packages/@pandino/event-admin/tsconfig.json | 22 +- .../@pandino/event-admin/tsconfig.test.json | 9 - packages/@pandino/event-admin/vite.config.ts | 40 + packages/@pandino/event-api/CHANGELOG.md | 22 +- packages/@pandino/event-api/README.md | 1 - .../event-api/dts-bundle-generator.config.ts | 17 + packages/@pandino/event-api/package.json | 23 +- packages/@pandino/event-api/rollup.config.js | 18 - packages/@pandino/event-api/tsconfig.json | 22 +- packages/@pandino/event-api/vite.config.ts | 36 + packages/@pandino/filters/CHANGELOG.md | 14 + packages/@pandino/filters/README.md | 1 - .../filters/dts-bundle-generator.config.ts | 17 + packages/@pandino/filters/package.json | 43 +- packages/@pandino/filters/rollup.config.js | 18 - packages/@pandino/filters/src/filters.test.ts | 1 + packages/@pandino/filters/src/filters.ts | 90 +- packages/@pandino/filters/tsconfig.json | 22 +- packages/@pandino/filters/tsconfig.test.json | 9 - packages/@pandino/filters/vite.config.ts | 36 + .../loader-configuration-dom/CHANGELOG.md | 22 +- .../loader-configuration-dom/README.md | 4 + .../dts-bundle-generator.config.ts | 17 + .../loader-configuration-dom/package.json | 21 +- .../loader-configuration-dom/rollup.config.js | 18 - .../loader-configuration-dom/src/index.ts | 8 +- .../loader-configuration-dom/tsconfig.json | 22 +- .../loader-configuration-dom/vite.config.ts | 40 + .../loader-configuration-nodejs/CHANGELOG.md | 22 +- .../loader-configuration-nodejs/README.md | 4 + .../dts-bundle-generator.config.ts | 17 + .../loader-configuration-nodejs/package.json | 26 +- .../rollup.config.js | 20 - .../loader-configuration-nodejs/src/index.ts | 12 +- .../loader-configuration-nodejs/tsconfig.json | 22 +- .../vite.config.ts | 47 + packages/@pandino/log-api/CHANGELOG.md | 22 +- packages/@pandino/log-api/README.md | 1 - .../log-api/dts-bundle-generator.config.ts | 17 + packages/@pandino/log-api/package.json | 23 +- packages/@pandino/log-api/rollup.config.js | 18 - packages/@pandino/log-api/src/log-entry.ts | 4 +- packages/@pandino/log-api/src/log-listener.ts | 2 +- .../log-api/src/log-reader-service.ts | 2 +- packages/@pandino/log-api/src/log-service.ts | 4 +- packages/@pandino/log-api/tsconfig.json | 22 +- packages/@pandino/log-api/vite.config.ts | 36 + .../@pandino/manifest-generator/CHANGELOG.md | 22 +- .../@pandino/manifest-generator/package.json | 6 +- .../src/{index.js => index.cjs} | 24 +- packages/@pandino/pandino-api/CHANGELOG.md | 22 +- packages/@pandino/pandino-api/README.md | 1 - .../dts-bundle-generator.config.ts | 17 + packages/@pandino/pandino-api/package.json | 25 +- .../@pandino/pandino-api/rollup.config.js | 18 - .../pandino-api/src/activator-resolver.ts | 2 +- .../src/bundle/bundle-activator.ts | 2 +- .../pandino-api/src/bundle/bundle-context.ts | 24 +- .../pandino-api/src/bundle/bundle-event.ts | 8 +- .../pandino-api/src/bundle/bundle-listener.ts | 2 +- .../src/bundle/bundle-manifest-headers.ts | 6 +- .../src/bundle/bundle-reference.ts | 4 +- .../src/bundle/bundle-tracker-customizer.ts | 10 +- .../pandino-api/src/bundle/bundle-tracker.ts | 4 +- .../@pandino/pandino-api/src/bundle/bundle.ts | 8 +- .../src/framework/framework-config-map.ts | 8 +- .../src/framework/framework-event-type.ts | 2 +- .../src/framework/framework-event.ts | 6 +- .../src/framework/framework-listener.ts | 2 +- .../src/service/prototype-service-factory.ts | 6 +- .../pandino-api/src/service/service-event.ts | 4 +- .../src/service/service-factory.ts | 6 +- .../src/service/service-listener.ts | 2 +- .../src/service/service-objects.ts | 2 +- .../src/service/service-reference.ts | 5 +- .../src/service/service-registration.ts | 6 +- .../src/service/service-tracker-customizer.ts | 4 +- .../src/service/service-tracker.ts | 4 +- .../pandino-api/src/service/service-utils.ts | 2 +- packages/@pandino/pandino-api/tsconfig.json | 22 +- packages/@pandino/pandino-api/vite.config.ts | 36 + packages/@pandino/pandino/CHANGELOG.md | 24 +- packages/@pandino/pandino/README.md | 1 - .../pandino/dts-bundle-generator.config.ts | 17 + packages/@pandino/pandino/package.json | 65 +- packages/@pandino/pandino/rollup.config.js | 18 - .../pandino/src/__mocks__/mute-logger.ts | 2 +- .../pandino/src/lib/filter/workarounds.ts | 27 - .../src/lib/framework/abstract-tracked.ts | 26 +- .../lib/framework/bundle-context-impl.test.ts | 37 +- .../src/lib/framework/bundle-context-impl.ts | 40 +- .../src/lib/framework/bundle-event-impl.ts | 4 +- .../pandino/src/lib/framework/bundle-impl.ts | 39 +- .../framework/bundle-revision-impl.test.ts | 6 +- .../src/lib/framework/bundle-revision-impl.ts | 35 +- .../src/lib/framework/bundle-revision.ts | 12 +- .../lib/framework/bundle-tracker-impl.test.ts | 30 +- .../src/lib/framework/bundle-tracker-impl.ts | 31 +- .../src/lib/framework/bundle-wiring-impl.ts | 53 +- .../src/lib/framework/bundle-wiring.ts | 18 +- .../capability-set/capability-set.test.ts | 8 +- .../capability-set/capability-set.ts | 52 +- .../lib/framework/esm-activator-resolver.ts | 2 +- .../src/lib/framework/event-dispatcher.ts | 46 +- .../src/lib/framework/framework-event-impl.ts | 6 +- .../pandino/src/lib/framework/framework.ts | 2 +- .../pandino/src/lib/framework/index.ts | 24 + .../src/lib/framework/resource/capability.ts | 6 +- .../src/lib/framework/resource/index.ts | 4 + .../src/lib/framework/resource/requirement.ts | 2 +- .../src/lib/framework/resource/resource.ts | 4 +- .../src/lib/framework/resource/wire.ts | 6 +- .../src/lib/framework/service-event-impl.ts | 8 +- .../src/lib/framework/service-objects-impl.ts | 14 +- .../framework/service-reference-impl.test.ts | 5 +- .../lib/framework/service-reference-impl.ts | 54 +- .../framework/service-registration-impl.ts | 39 +- .../framework/service-registry-callbacks.ts | 4 +- .../framework/service-registry-impl.test.ts | 13 +- .../lib/framework/service-registry-impl.ts | 134 +- .../src/lib/framework/service-registry.ts | 6 +- .../framework/service-tracker-impl.test.ts | 20 +- .../src/lib/framework/service-tracker-impl.ts | 107 +- .../lib/framework/stateful-resolver.test.ts | 10 +- .../src/lib/framework/stateful-resolver.ts | 53 +- .../src/lib/framework/usage-count-impl.ts | 4 +- .../pandino/src/lib/framework/usage-count.ts | 2 +- .../lib/framework/util/listener-info.test.ts | 11 +- .../src/lib/framework/util/listener-info.ts | 16 +- .../framework/util/manifest-parser/index.ts | 4 + .../manifest-parser-impl.test.ts | 22 +- .../manifest-parser/manifest-parser-impl.ts | 68 +- .../util/manifest-parser/manifest-parser.ts | 10 +- .../util/manifest-parser/utils.test.ts | 1 + .../framework/util/manifest-parser/utils.ts | 4 +- .../wiring/bundle-capability-impl.test.ts | 21 +- .../wiring/bundle-capability-impl.ts | 31 +- .../lib/framework/wiring/bundle-capability.ts | 10 +- .../wiring/bundle-requirement-impl.test.ts | 7 +- .../wiring/bundle-requirement-impl.ts | 8 +- .../framework/wiring/bundle-requirement.ts | 6 +- .../framework/wiring/bundle-wire-impl.test.ts | 9 +- .../lib/framework/wiring/bundle-wire-impl.ts | 11 +- .../src/lib/framework/wiring/bundle-wire.ts | 6 +- .../pandino/src/lib/utils/console-logger.ts | 3 +- .../pandino/src/lib/utils/helpers.test.ts | 39 - .../@pandino/pandino/src/lib/utils/helpers.ts | 12 - .../@pandino/pandino/src/lib/utils/index.ts | 4 + .../pandino/src/lib/utils/service-utils.ts | 2 +- .../pandino/src/lib/utils/void-fetcher.ts | 2 +- .../pandino/src/lib/utils/void-importer.ts | 2 +- packages/@pandino/pandino/src/pandino.test.ts | 37 +- packages/@pandino/pandino/src/pandino.ts | 154 +- packages/@pandino/pandino/tsconfig.json | 22 +- packages/@pandino/pandino/tsconfig.test.json | 9 - packages/@pandino/pandino/vite.config.ts | 36 + .../persistence-manager-api/CHANGELOG.md | 22 +- .../persistence-manager-api/README.md | 1 - .../dts-bundle-generator.config.ts | 17 + .../persistence-manager-api/package.json | 23 +- .../persistence-manager-api/rollup.config.js | 18 - .../src/persistence-manager.ts | 2 +- .../persistence-manager-api/tsconfig.json | 22 +- .../persistence-manager-api/vite.config.ts | 36 + .../CHANGELOG.md | 22 +- .../README.md | 1 - .../dts-bundle-generator.config.ts | 17 + .../package.json | 59 +- .../rollup.config.js | 20 - .../src/activator.ts | 27 +- .../src/service.test.ts | 29 +- .../src/service.ts | 17 +- .../tsconfig.json | 22 +- .../tsconfig.test.json | 9 - .../vite.config.ts | 40 + .../persistence-manager-memory/CHANGELOG.md | 22 +- .../persistence-manager-memory/README.md | 1 - .../dts-bundle-generator.config.ts | 17 + .../persistence-manager-memory/package.json | 63 +- .../rollup.config.js | 20 - .../persistence-manager-memory/src/index.ts | 3 +- .../src/service.test.ts | 3 +- .../persistence-manager-memory/src/service.ts | 4 +- .../persistence-manager-memory/tsconfig.json | 22 +- .../tsconfig.test.json | 9 - .../persistence-manager-memory/vite.config.ts | 40 + packages/@pandino/react-hooks/CHANGELOG.md | 22 +- packages/@pandino/react-hooks/README.md | 37 +- .../dts-bundle-generator.config.ts | 17 + packages/@pandino/react-hooks/package.json | 22 +- .../@pandino/react-hooks/rollup.config.js | 19 - .../react-hooks/src/PandinoContext.tsx | 2 +- packages/@pandino/react-hooks/src/index.tsx | 1 + .../react-hooks/src/useServiceInterceptor.ts | 42 + .../react-hooks/src/useTrackService.ts | 8 +- packages/@pandino/react-hooks/tsconfig.json | 22 +- packages/@pandino/react-hooks/vite.config.ts | 36 + .../CHANGELOG.md | 24 +- .../rollup-plugin-generate-manifest/README.md | 1 - .../package.json | 8 +- .../src/index.cjs | 17 + .../src/index.js | 15 - .../umd-activator-resolver-dom/CHANGELOG.md | 22 +- .../umd-activator-resolver-dom/README.md | 1 - .../dts-bundle-generator.config.ts | 17 + .../umd-activator-resolver-dom/package.json | 20 +- .../rollup.config.js | 18 - .../umd-activator-resolver-dom/src/index.ts | 10 +- .../umd-activator-resolver-dom/tsconfig.json | 22 +- .../umd-activator-resolver-dom/vite.config.ts | 36 + .../CHANGELOG.md | 24 +- .../README.md | 1 - .../package.json | 10 +- .../src/index.js | 2 +- pnpm-lock.yaml | 3840 ++++++ pnpm-workspace.yaml | 2 + rollup/rollup-utils.mjs | 36 - 356 files changed, 7569 insertions(+), 21371 deletions(-) create mode 100644 .changeset/config.json create mode 100644 .npmrc create mode 100644 examples/basic-browser-js/.gitignore create mode 100755 examples/basic-browser-js/cp-dependencies.sh create mode 100644 examples/browser-clicky-js/.gitignore create mode 100755 examples/browser-clicky-js/cp-dependencies.sh create mode 100644 examples/configuration-manager-browser-js/.gitignore create mode 100755 examples/configuration-manager-browser-js/cp-dependencies.sh create mode 100755 examples/custom-elements-web-js/cp-dependencies.sh delete mode 100644 examples/react-systemjs/.prettierrc delete mode 100644 examples/react-systemjs/README.md delete mode 100644 examples/react-systemjs/lerna.json delete mode 100644 examples/react-systemjs/package-lock.json delete mode 100644 examples/react-systemjs/package.json delete mode 100644 examples/react-systemjs/packages/app/package.json delete mode 100644 examples/react-systemjs/packages/app/repackaged/react-dom-client.tsx delete mode 100644 examples/react-systemjs/packages/app/repackaged/react-is.tsx delete mode 100644 examples/react-systemjs/packages/app/repackaged/react-jsx-runtime.tsx delete mode 100644 examples/react-systemjs/packages/app/rollup.config.mjs delete mode 100644 examples/react-systemjs/packages/app/rollup/helpers.mjs delete mode 100644 examples/react-systemjs/packages/app/serve.json delete mode 100644 examples/react-systemjs/packages/app/src/App.tsx delete mode 100644 examples/react-systemjs/packages/app/src/FallbackComponent.tsx delete mode 100644 examples/react-systemjs/packages/app/src/main.tsx delete mode 100644 examples/react-systemjs/packages/app/src/service.ts delete mode 100644 examples/react-systemjs/packages/app/tsconfig.json delete mode 100644 examples/react-systemjs/packages/component-api/package.json delete mode 100644 examples/react-systemjs/packages/component-api/rollup.config.js delete mode 100644 examples/react-systemjs/packages/component-api/src/index.ts delete mode 100644 examples/react-systemjs/packages/component-api/tsconfig.json delete mode 100644 examples/react-systemjs/packages/component-one/package.json delete mode 100644 examples/react-systemjs/packages/component-one/rollup.config.mjs delete mode 100644 examples/react-systemjs/packages/component-one/src/ComponentOne.tsx delete mode 100644 examples/react-systemjs/packages/component-one/src/index.tsx delete mode 100644 examples/react-systemjs/packages/component-one/tsconfig.json create mode 100755 examples/string-inverter/cp-dependencies.sh rename tsconfig.base.json => examples/tsconfig.base.json (100%) delete mode 100644 lerna.json delete mode 100644 package-lock.json create mode 100644 packages/@pandino/bundle-installer-dom/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/bundle-installer-dom/rollup.config.js create mode 100644 packages/@pandino/bundle-installer-dom/vite.config.ts create mode 100644 packages/@pandino/bundle-installer-nodejs/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/bundle-installer-nodejs/rollup.config.js create mode 100644 packages/@pandino/bundle-installer-nodejs/vite.config.ts create mode 100644 packages/@pandino/configuration-management-api/dts-bundle-generator.config.ts create mode 100644 packages/@pandino/configuration-management-api/vite.config.ts create mode 100644 packages/@pandino/configuration-management/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/configuration-management/rollup.config.js delete mode 100644 packages/@pandino/configuration-management/tsconfig.test.json create mode 100644 packages/@pandino/configuration-management/vite.config.ts create mode 100644 packages/@pandino/event-admin/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/event-admin/rollup.config.js delete mode 100644 packages/@pandino/event-admin/tsconfig.test.json create mode 100644 packages/@pandino/event-admin/vite.config.ts create mode 100644 packages/@pandino/event-api/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/event-api/rollup.config.js create mode 100644 packages/@pandino/event-api/vite.config.ts create mode 100644 packages/@pandino/filters/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/filters/rollup.config.js delete mode 100644 packages/@pandino/filters/tsconfig.test.json create mode 100644 packages/@pandino/filters/vite.config.ts create mode 100644 packages/@pandino/loader-configuration-dom/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/loader-configuration-dom/rollup.config.js create mode 100644 packages/@pandino/loader-configuration-dom/vite.config.ts create mode 100644 packages/@pandino/loader-configuration-nodejs/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/loader-configuration-nodejs/rollup.config.js create mode 100644 packages/@pandino/loader-configuration-nodejs/vite.config.ts create mode 100644 packages/@pandino/log-api/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/log-api/rollup.config.js create mode 100644 packages/@pandino/log-api/vite.config.ts rename packages/@pandino/manifest-generator/src/{index.js => index.cjs} (72%) create mode 100644 packages/@pandino/pandino-api/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/pandino-api/rollup.config.js create mode 100644 packages/@pandino/pandino-api/vite.config.ts create mode 100644 packages/@pandino/pandino/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/pandino/rollup.config.js delete mode 100644 packages/@pandino/pandino/src/lib/filter/workarounds.ts create mode 100644 packages/@pandino/pandino/src/lib/framework/index.ts create mode 100644 packages/@pandino/pandino/src/lib/framework/resource/index.ts create mode 100644 packages/@pandino/pandino/src/lib/framework/util/manifest-parser/index.ts delete mode 100644 packages/@pandino/pandino/src/lib/utils/helpers.test.ts delete mode 100644 packages/@pandino/pandino/src/lib/utils/helpers.ts create mode 100644 packages/@pandino/pandino/src/lib/utils/index.ts delete mode 100644 packages/@pandino/pandino/tsconfig.test.json create mode 100644 packages/@pandino/pandino/vite.config.ts create mode 100644 packages/@pandino/persistence-manager-api/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/persistence-manager-api/rollup.config.js create mode 100644 packages/@pandino/persistence-manager-api/vite.config.ts create mode 100644 packages/@pandino/persistence-manager-localstorage/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/persistence-manager-localstorage/rollup.config.js delete mode 100644 packages/@pandino/persistence-manager-localstorage/tsconfig.test.json create mode 100644 packages/@pandino/persistence-manager-localstorage/vite.config.ts create mode 100644 packages/@pandino/persistence-manager-memory/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/persistence-manager-memory/rollup.config.js delete mode 100644 packages/@pandino/persistence-manager-memory/tsconfig.test.json create mode 100644 packages/@pandino/persistence-manager-memory/vite.config.ts create mode 100644 packages/@pandino/react-hooks/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/react-hooks/rollup.config.js create mode 100644 packages/@pandino/react-hooks/src/useServiceInterceptor.ts create mode 100644 packages/@pandino/react-hooks/vite.config.ts create mode 100644 packages/@pandino/rollup-plugin-generate-manifest/src/index.cjs delete mode 100644 packages/@pandino/rollup-plugin-generate-manifest/src/index.js create mode 100644 packages/@pandino/umd-activator-resolver-dom/dts-bundle-generator.config.ts delete mode 100644 packages/@pandino/umd-activator-resolver-dom/rollup.config.js create mode 100644 packages/@pandino/umd-activator-resolver-dom/vite.config.ts create mode 100644 pnpm-lock.yaml create mode 100644 pnpm-workspace.yaml delete mode 100644 rollup/rollup-utils.mjs diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 00000000..2197cb75 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [], + "linked": [], + "access": "restricted", + "baseBranch": "master", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 0e06b1d1..2a911e07 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -4,6 +4,7 @@ on: push: branches: - develop + - release/** paths-ignore: - '**.md' pull_request: @@ -16,20 +17,45 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x] + node-version: [18.x, 20.x] steps: - uses: actions/checkout@v3 + - name: setup git config run: | git config user.name "blackbelt-oss" git config user.email "oss@blackbelt.hu" + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm i -g npm - - run: npm ci - - run: npm run build --if-present - - run: npm test + + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Test + run: pnpm run test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd9b7213..7d4a2fc9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,18 +20,45 @@ jobs: steps: - uses: actions/checkout@v3 + - name: setup git config run: | git config user.name "blackbelt-oss" git config user.email "oss@blackbelt.hu" + - name: Use Node.js 18.x uses: actions/setup-node@v3 with: node-version: 18.x - cache: 'npm' registry-url: https://registry.npmjs.org/ - - run: npm i -g npm - - run: npm ci - - run: npm run build --if-present - - run: npm test - - run: npm run new-publish:ci + + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Build + run: pnpm run build + + - name: Test + run: pnpm run test + + - name: Publish + run: npx changeset publish diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..e5c2cff4 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +hoist=true +auto-install-peers = true diff --git a/CHANGELOG.md b/CHANGELOG.md index 86d2ccf0..bebdc922 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# (2023-07-24) +# (2023-11-11) @@ -7,6 +7,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 0.8.30 (2023-11-11) + +**Note:** Version bump only for package pandino-root + +## 0.8.29 (2023-07-24) + +**Note:** Version bump only for package pandino-root + ## 0.8.28 (2023-07-24) **Note:** Version bump only for package pandino-root diff --git a/README.md b/README.md index 9584b88e..90053a84 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,12 @@ [![Discord](https://img.shields.io/discord/1014474039017865256)](https://discord.gg/Gr38aEzyx7) [![license](https://img.shields.io/badge/license-EPL%20v2.0-blue.svg)](https://github.com/BlackBeltTechnology/pandino) [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/) -[![Conventional Changelog](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-conventional--changelog-e10079.svg?style=flat)](https://github.com/conventional-changelog/conventional-changelog) -[![lerna--lite](https://img.shields.io/badge/maintained%20with-lerna--lite-e137ff)](https://github.com/ghiscoding/lerna-lite) An OSGi - lite framework for JavaScript runtimes. ## What is Pandino -Pandino was designed to build on top of the **L** and **D** sections of the [SOLID principles](https://www.digitalocean.com/community/conceptual-articles/s-o-l-i-d-the-first-five-principles-of-object-oriented-design). - -It helps build software in a way where certain functionalities are "interfaced" and concrete implementation(s) are provided at runtime or potentially by different teams. +Pandino helps build software in a way where functionality is "interfaced" and concrete implementation(s) are provided at runtime or potentially by different teams. Other tools provide dependency injection capabilities but Pandino is more. Pandino gives us the ability to wire in implementation in a way where it can come and **go** at runtime. It is also worth noting that Pandino does not require you to install specialized tooling to work compared to other micro-frontend frameworks / tools. @@ -26,7 +22,7 @@ Pandino is also extendable, some of the functionalities defined in the [OSGi Com ## Supported platforms Pandino can be used as an [ES Module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) in browsers -and NodeJS v16, and v18 as well. To support legacy setups, we export CJS modules as well, where applicable. +and NodeJS v18, and v20 as well. To support legacy setups, we export CJS modules as well, where applicable. ## Inspiration @@ -87,19 +83,8 @@ a custom service which will alter the application it self. In this example we are importing a `loaderConfiguration`. This is only for our convenience, you can implement your own loader if for some reason the default is not sufficient! -Pandino has 2 mandatory init parameters (which the `loaderConfiguration` also implement): -- `pandino.manifest.fetcher`: an object with a `fetch()` method where we implement the [Manifest](./docs/basics.md) loading mechanism -- `pandino.bundle.importer`: an object with an `import()` method where we implement the [Activator](./docs/basics.md) loading mechanism - -The reason for why we would want to manually define `pandino.manifest.fetcher` and `pandino.bundle.importer` is that -Pandino it self is platform agnostic, which means that the "file loading" mechanism will be different in e.g. a Browser -compared to NodeJS. - -Another benefit is that this way the library user can fine-tune the loading logic if needed (e.g.: handle proxies, -etc...). - -A complete list of Framework configuration properties can be found in the corresponding source code: -[framework-config-map.ts](packages/@pandino/pandino-api/src/framework/framework-config-map.ts) +Loaders abstract away mandatory configurations for each platform. A complete list of Framework configuration properties +can be found in the corresponding source code: [framework-config-map.ts](packages/@pandino/pandino-api/src/framework/framework-config-map.ts) > For different platforms or languages, please check the [installation documentation](./docs/installation.md)! diff --git a/docs/osgi-comparison.md b/docs/osgi-comparison.md index 7819a8e5..870a65bc 100644 --- a/docs/osgi-comparison.md +++ b/docs/osgi-comparison.md @@ -4,6 +4,7 @@ | Feature | OSGi | Pandino | |--------------------------------------------|--------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------| | `BundleActivator` methods | `sync` | `async` | +| `BundleActivator` cardinality | We can declare any number of activators in a Bundle | We can only have a single activator per Bundle | | Bundle States | A Bundle only goes to `RESOLVED` state once the class loader is prepared | Pandino only supports 5 states: `UNINSTALLED`, `INSTALLED`, `STARTING`, `ACTIVE`, `STOPPING` | | Service Scopes | `SINGLETON`, `PROTOTYPE`, `BUNDLE` | Only `SINGLETON` and `PROTOTYPE` are supported currently | | Version Type | Self-defined `Version` type | Full-blown `SemVer` | diff --git a/examples/README.md b/examples/README.md index 643990e1..d96206f6 100644 --- a/examples/README.md +++ b/examples/README.md @@ -33,7 +33,3 @@ or in certain cases install them via NPM! Using CDNs is not mandatory. ## Activator Resolvers - [umd-bundle-ts](./umd-bundle-ts) - -## React integration - -- [react-systemjs](./react-systemjs) diff --git a/examples/basic-browser-js/.gitignore b/examples/basic-browser-js/.gitignore new file mode 100644 index 00000000..686fb1a6 --- /dev/null +++ b/examples/basic-browser-js/.gitignore @@ -0,0 +1 @@ +dist/@pandino diff --git a/examples/basic-browser-js/README.md b/examples/basic-browser-js/README.md index 80311026..0111c5dd 100644 --- a/examples/basic-browser-js/README.md +++ b/examples/basic-browser-js/README.md @@ -4,6 +4,8 @@ A simple example showcasing Pandino implementation details for a Browser-based p in pure JavaScript. ## Running the example -Run `npx serve dist` in this folder to start a web server +- Run `pnpm run build` first in the project root to create local artifacts +- Run `./cp-dependencies.sh` to copy library artifacts +- Run `npx serve dist` in this folder to start a web server > Server will start at: http://localhost:3000 diff --git a/examples/basic-browser-js/cp-dependencies.sh b/examples/basic-browser-js/cp-dependencies.sh new file mode 100755 index 00000000..dfba8d53 --- /dev/null +++ b/examples/basic-browser-js/cp-dependencies.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +rm -rf dist/@pandino + +mkdir -p dist/@pandino + +cp -r ../../packages/@pandino/bundle-installer-dom/dist/@pandino ./dist +cp -r ../../packages/@pandino/loader-configuration-dom/dist/@pandino ./dist +cp -r ../../packages/@pandino/pandino/dist/@pandino ./dist diff --git a/examples/basic-browser-js/dist/index.html b/examples/basic-browser-js/dist/index.html index 27d626c3..96df0d78 100644 --- a/examples/basic-browser-js/dist/index.html +++ b/examples/basic-browser-js/dist/index.html @@ -16,8 +16,8 @@

Hello!

] diff --git a/examples/basic-browser-ts/cp-dependencies.sh b/examples/basic-browser-ts/cp-dependencies.sh index bc3d7393..8a8ce907 100755 --- a/examples/basic-browser-ts/cp-dependencies.sh +++ b/examples/basic-browser-ts/cp-dependencies.sh @@ -1,7 +1,11 @@ #!/bin/bash +set -e + cp packages/bundle-a/dist/bundle-a-manifest.json packages/app/assets/bundle-a-manifest.json -cp packages/bundle-a/dist/bundle-a.mjs packages/app/assets/bundle-a.mjs +cp packages/bundle-a/dist/bundle-a.js packages/app/assets/bundle-a.js cp packages/bundle-b/dist/bundle-b-manifest.json packages/app/assets/bundle-b-manifest.json cp packages/bundle-b/dist/bundle-b.js packages/app/assets/bundle-b.js + +cp -r ../../packages/@pandino/bundle-installer-dom/dist/@pandino ./packages/app/assets diff --git a/examples/basic-browser-ts/package-lock.json b/examples/basic-browser-ts/package-lock.json index dddae704..daff53b0 100644 --- a/examples/basic-browser-ts/package-lock.json +++ b/examples/basic-browser-ts/package-lock.json @@ -16,6 +16,68 @@ "@lerna-lite/run": "^1.13.0" } }, + "../../packages/@pandino/loader-configuration-dom": { + "version": "0.8.30", + "license": "EPL-2.0", + "devDependencies": { + "@pandino/pandino-api": "workspace:^0.8.29", + "@pandino/rollup-plugin-generate-manifest": "workspace:^0.8.29", + "dts-bundle-generator": "^8.1.2", + "rimraf": "^5.0.5", + "typescript": "^5.2.2", + "vite": "^4.5.0" + }, + "engines": { + "node": ">=18" + } + }, + "../../packages/@pandino/pandino": { + "version": "0.8.30", + "license": "EPL-2.0", + "dependencies": { + "@pandino/filters": "workspace:^0.8.29" + }, + "devDependencies": { + "@pandino/pandino-api": "workspace:^0.8.29", + "dts-bundle-generator": "^8.1.2", + "rimraf": "^5.0.5", + "typescript": "^5.2.2", + "vite": "^4.5.0", + "vitest": "^0.34.6" + }, + "engines": { + "node": ">=18" + } + }, + "../../packages/@pandino/pandino-api": { + "version": "0.8.30", + "dev": true, + "license": "EPL-2.0", + "devDependencies": { + "dts-bundle-generator": "^8.1.2", + "rimraf": "^5.0.5", + "typescript": "^5.2.2", + "vite": "^4.5.0" + }, + "engines": { + "node": ">=18" + } + }, + "../../packages/@pandino/webpack-plugin-generate-manifest": { + "version": "0.8.30", + "dev": true, + "license": "EPL-2.0", + "dependencies": { + "@pandino/manifest-generator": "workspace:^0.8.29" + }, + "devDependencies": { + "webpack": "^5.89.0", + "webpack-cli": "^5.1.4" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@babel/code-frame": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.5.tgz", @@ -1045,62 +1107,21 @@ "@octokit/openapi-types": "^18.0.0" } }, - "node_modules/@pandino/filters": { - "version": "0.8.28", - "resolved": "https://registry.npmjs.org/@pandino/filters/-/filters-0.8.28.tgz", - "integrity": "sha512-OETjHnczXKC5pmGAUlOUwUxqyH4uATKEr1+16IpxtitCGFbCasuBuitBkd9RhRrjMOdboZgbgCBa2LmKasH11g==", - "engines": { - "node": ">=14.9.0" - } - }, "node_modules/@pandino/loader-configuration-dom": { - "version": "0.8.28", - "resolved": "file:../../packages/@pandino/loader-configuration-dom", - "license": "EPL-2.0", - "engines": { - "node": ">=14.9.0" - } - }, - "node_modules/@pandino/manifest-generator": { - "version": "0.8.28", - "resolved": "https://registry.npmjs.org/@pandino/manifest-generator/-/manifest-generator-0.8.28.tgz", - "integrity": "sha512-cSZcbTdIiUwejlxRvhIScG7pNhVAN+1X33fDvchKCAsfknH86QVju4yGsJp3KTm23E+ktOIk+US3zrkE/UuMLA==", - "dev": true, - "engines": { - "node": ">=14.9.0" - } + "resolved": "../../packages/@pandino/loader-configuration-dom", + "link": true }, "node_modules/@pandino/pandino": { - "version": "0.8.28", - "resolved": "file:../../packages/@pandino/pandino", - "license": "EPL-2.0", - "dependencies": { - "@pandino/filters": "^0.8.28" - }, - "engines": { - "node": ">=14.9.0" - } + "resolved": "../../packages/@pandino/pandino", + "link": true }, "node_modules/@pandino/pandino-api": { - "version": "0.8.28", - "resolved": "file:../../packages/@pandino/pandino-api", - "dev": true, - "license": "EPL-2.0", - "engines": { - "node": ">=14.9.0" - } + "resolved": "../../packages/@pandino/pandino-api", + "link": true }, "node_modules/@pandino/webpack-plugin-generate-manifest": { - "version": "0.8.28", - "resolved": "file:../../packages/@pandino/webpack-plugin-generate-manifest", - "dev": true, - "license": "EPL-2.0", - "dependencies": { - "@pandino/manifest-generator": "^0.8.28" - }, - "engines": { - "node": ">=14.9.0" - } + "resolved": "../../packages/@pandino/webpack-plugin-generate-manifest", + "link": true }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", diff --git a/examples/basic-browser-ts/packages/app/src/index.ejs b/examples/basic-browser-ts/packages/app/src/index.ejs index 46321a99..4e1cb604 100644 --- a/examples/basic-browser-ts/packages/app/src/index.ejs +++ b/examples/basic-browser-ts/packages/app/src/index.ejs @@ -5,6 +5,8 @@ <%= htmlWebpackPlugin.options.title %> +

Hello!

+

Please check the console for demo content!

diff --git a/examples/configuration-manager-browser-js/.gitignore b/examples/configuration-manager-browser-js/.gitignore new file mode 100644 index 00000000..686fb1a6 --- /dev/null +++ b/examples/configuration-manager-browser-js/.gitignore @@ -0,0 +1 @@ +dist/@pandino diff --git a/examples/configuration-manager-browser-js/README.md b/examples/configuration-manager-browser-js/README.md index 742c02dc..c6e31a3f 100644 --- a/examples/configuration-manager-browser-js/README.md +++ b/examples/configuration-manager-browser-js/README.md @@ -3,7 +3,9 @@ A simple example showcasing the ConfigAdmin capabilities with a `Localstorage` Persistence Manager implementation. ## Running the example -Run `npx serve dist` in this folder to start a web server +- Run `pnpm run build` first in the project root to create local artifacts +- Run `./cp-dependencies.sh` to copy library artifacts +- Run `npx serve dist` in this folder to start a web server > Server will start at: http://localhost:3000 diff --git a/examples/configuration-manager-browser-js/cp-dependencies.sh b/examples/configuration-manager-browser-js/cp-dependencies.sh new file mode 100755 index 00000000..b58605c0 --- /dev/null +++ b/examples/configuration-manager-browser-js/cp-dependencies.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +rm -rf dist/@pandino + +mkdir -p dist/@pandino + +cp -r ../../packages/@pandino/bundle-installer-dom/dist/@pandino ./dist +cp -r ../../packages/@pandino/loader-configuration-dom/dist/@pandino ./dist +cp -r ../../packages/@pandino/persistence-manager-localstorage/dist/@pandino ./dist +cp -r ../../packages/@pandino/configuration-management/dist/@pandino ./dist +cp -r ../../packages/@pandino/pandino/dist/@pandino ./dist diff --git a/examples/configuration-manager-browser-js/dist/index.html b/examples/configuration-manager-browser-js/dist/index.html index 9f13a904..71def34e 100644 --- a/examples/configuration-manager-browser-js/dist/index.html +++ b/examples/configuration-manager-browser-js/dist/index.html @@ -11,14 +11,14 @@

Hello!

Please check the console for demo content!

`; - // }) - // .join(EOL); - - const links = (files.css || []) - .map(({fileName}) => { - const attrs = makeHtmlAttributes(attributes.link); - return ``; - }) - .join(EOL); - - const metas = meta - .map((input) => { - const attrs = makeHtmlAttributes(input); - return ``; - }) - .join(EOL); - - return ` - - - - ${metas} - ${title} - ${links} - - - - - - -
- - -`; -}; - -const repackagedConfig = { - plugins: [ - replace({ - preventAssignment: false, - values: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - }), - nodeResolve(), - commonjs(), - esbuild({ - minify: ENV === 'production', - }), - ], -}; - -export const generateRepackagedOutput = (inputName, targetName) => { - return { - input: `repackaged/${inputName}.tsx`, - output: { - file: `dist/${targetName}.system.js`, - format: 'system', - sourcemap: ENV === 'production', - }, - external: ['react'], - ...repackagedConfig, - }; -}; diff --git a/examples/react-systemjs/packages/app/serve.json b/examples/react-systemjs/packages/app/serve.json deleted file mode 100644 index ce6c2346..00000000 --- a/examples/react-systemjs/packages/app/serve.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "public": "dist", - "rewrites": [ - { "source": "**", "destination": "/index.html" } - ] -} diff --git a/examples/react-systemjs/packages/app/src/App.tsx b/examples/react-systemjs/packages/app/src/App.tsx deleted file mode 100644 index 1ad75c24..00000000 --- a/examples/react-systemjs/packages/app/src/App.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import type { FC } from 'react'; -import { useState } from 'react'; -import { OBJECTCLASS } from '@pandino/pandino-api'; -import { ComponentProxy } from '@pandino/react-hooks'; -import { CUSTOM_COMPONENT_INTERFACE_KEY } from '@react-systemjs/component-api'; -import { FallbackComponent } from './FallbackComponent'; - -export const App: FC = () => { - const [firstName] = useState('John'); - - console.count('Rendering App.'); - - return ( - - - - ); -}; diff --git a/examples/react-systemjs/packages/app/src/FallbackComponent.tsx b/examples/react-systemjs/packages/app/src/FallbackComponent.tsx deleted file mode 100644 index 0663880e..00000000 --- a/examples/react-systemjs/packages/app/src/FallbackComponent.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { useMemo } from 'react'; -import { OBJECTCLASS } from '@pandino/pandino-api'; -import { useTrackService } from '@pandino/react-hooks'; -import type { CustomComponent } from '@react-systemjs/component-api'; -import { SOME_SERVICE_INTERFACE_KEY, SomeService } from './service'; - -export const FallbackComponent: CustomComponent = (props) => { - const { service: someService } = useTrackService(`(${OBJECTCLASS}=${SOME_SERVICE_INTERFACE_KEY})`); - const text = useMemo(() => someService?.someMethod(), [someService]); - - console.count('Rendering FallbackComponent.'); - console.info(`SomeService implementation: ${someService}`); - - return ( -
-
fallback for: {props.firstName}
-
SomeService test: {someService?.someMethod()}
-
Text: {text}
-
- ); -}; diff --git a/examples/react-systemjs/packages/app/src/main.tsx b/examples/react-systemjs/packages/app/src/main.tsx deleted file mode 100644 index 49bb445b..00000000 --- a/examples/react-systemjs/packages/app/src/main.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { useState } from 'react'; -import { createRoot } from 'react-dom/client'; -import Pandino from '@pandino/pandino'; -import loaderConfiguration from '@pandino/loader-configuration-dom'; -import { PandinoProvider } from '@pandino/react-hooks'; -import { CUSTOM_COMPONENT_INTERFACE_KEY, CustomComponent } from '@react-systemjs/component-api'; -import { App } from './App'; -import { SOME_SERVICE_INTERFACE_KEY, SomeServiceImpl } from './service'; - -const root = createRoot(document.querySelector('#root')!); - -const pandino = new Pandino({ - ...loaderConfiguration, -}); - -await pandino.init(); -await pandino.start(); - -const bundleContext = pandino.getBundleContext(); - -export const ComponentOne: CustomComponent = (props) => { - const [data, setData] = useState<{ firstName: string; lastName?: string }>({ ...props }); - - return ( -
-

Component One

-

FirstName: {data.firstName}

-

LastName: {data.lastName}

-
- ); -}; - -const reg = bundleContext.registerService(CUSTOM_COMPONENT_INTERFACE_KEY, ComponentOne); -window.setTimeout(() => { - reg.unregister(); - window.setTimeout(() => { - bundleContext.registerService(CUSTOM_COMPONENT_INTERFACE_KEY, ComponentOne); - }, 2000); -}, 2000); - -// (async () => { -// const componentOneBundle = await bundleContext.installBundle('./component-one.system-manifest.json'); -// window.setTimeout(() => { -// pandino.uninstallBundle(componentOneBundle as any); -// window.setTimeout(() => { -// bundleContext.installBundle('./component-one.system-manifest.json'); -// }, 2000); -// }, 2000); -// })(); - -// (async () => { -// let someReg = await bundleContext.registerService(SOME_SERVICE_INTERFACE_KEY, new SomeServiceImpl()); -// window.setTimeout(async () => { -// someReg.unregister(); -// window.setTimeout(async () => { -// someReg = await bundleContext.registerService(SOME_SERVICE_INTERFACE_KEY, new SomeServiceImpl()); -// }, 2000); -// }, 2000); -// })(); - -root.render( - - - , -); diff --git a/examples/react-systemjs/packages/app/src/service.ts b/examples/react-systemjs/packages/app/src/service.ts deleted file mode 100644 index dffef91f..00000000 --- a/examples/react-systemjs/packages/app/src/service.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const SOME_SERVICE_INTERFACE_KEY = 'SomeService'; - -export interface SomeService { - someMethod(): string; -} - -export class SomeServiceImpl implements SomeService { - someMethod(): string { - return "some fine service"; - } -} diff --git a/examples/react-systemjs/packages/app/tsconfig.json b/examples/react-systemjs/packages/app/tsconfig.json deleted file mode 100644 index ac57ec22..00000000 --- a/examples/react-systemjs/packages/app/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "lib": ["DOM", "DOM.Iterable", "ESNext"], - "allowJs": false, - "skipLibCheck": true, - "esModuleInterop": false, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "module": "ESNext", - "moduleResolution": "Node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx" - }, - "include": [ - "src" - ] -} diff --git a/examples/react-systemjs/packages/component-api/package.json b/examples/react-systemjs/packages/component-api/package.json deleted file mode 100644 index 968b860e..00000000 --- a/examples/react-systemjs/packages/component-api/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@react-systemjs/component-api", - "version": "1.0.0", - "private": true, - "type": "module", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", - "exports": { - ".": { - "default": "./dist/index.js" - } - }, - "scripts": { - "build:types": "tsc --emitDeclarationOnly --declaration --project tsconfig.json", - "build": "cross-env NODE_ENV=production rollup -c && npm run build:types", - "build:ci": "cross-env NODE_ENV=production tsc && npm run build", - "build:dev": "rollup -c && npm run build:types" - }, - "keywords": [], - "devDependencies": { - "@types/react": "^18.0.26" - } -} diff --git a/examples/react-systemjs/packages/component-api/rollup.config.js b/examples/react-systemjs/packages/component-api/rollup.config.js deleted file mode 100644 index f8603cf0..00000000 --- a/examples/react-systemjs/packages/component-api/rollup.config.js +++ /dev/null @@ -1,26 +0,0 @@ -import * as dotenv from 'dotenv'; -import clear from 'rollup-plugin-clear'; -import esbuild from 'rollup-plugin-esbuild'; - -dotenv.config(); - -const ENV = process.env.NODE_ENV; - -export default [ - { - input: 'src/index.ts', - output: { - dir: 'dist', - format: 'esm', - sourcemap: ENV === 'production', - }, - plugins: [ - clear({ - targets: ['dist'], - }), - esbuild({ - minify: ENV === 'production', - }), - ], - }, -]; diff --git a/examples/react-systemjs/packages/component-api/src/index.ts b/examples/react-systemjs/packages/component-api/src/index.ts deleted file mode 100644 index c18eff50..00000000 --- a/examples/react-systemjs/packages/component-api/src/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { FC } from 'react'; - -export const CUSTOM_COMPONENT_INTERFACE_KEY = '@react-systemjs/component-api/CustomComponent'; - -export interface CustomComponent extends FC {} - -export interface ComponentProps { - firstName: string; - lastName?: string; -} diff --git a/examples/react-systemjs/packages/component-api/tsconfig.json b/examples/react-systemjs/packages/component-api/tsconfig.json deleted file mode 100644 index d73f830a..00000000 --- a/examples/react-systemjs/packages/component-api/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "lib": ["DOM", "DOM.Iterable", "ESNext"], - "allowJs": false, - "skipLibCheck": true, - "esModuleInterop": false, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "module": "ESNext", - "moduleResolution": "Node", - "resolveJsonModule": true, - "isolatedModules": true, - "declaration": true, - "declarationDir": "dist", - "jsx": "react-jsx" - }, - "include": [ - "src" - ] -} diff --git a/examples/react-systemjs/packages/component-one/package.json b/examples/react-systemjs/packages/component-one/package.json deleted file mode 100644 index 16532fca..00000000 --- a/examples/react-systemjs/packages/component-one/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@react-systemjs/component-one", - "version": "1.0.0", - "private": true, - "type": "module", - "module": "./dist/component-one.mjs", - "exports": { - ".": { - "default": "./dist/component-one.mjs" - } - }, - "scripts": { - "build": "cross-env NODE_ENV=production rollup -c", - "build:ci": "cross-env NODE_ENV=production tsc && rollup -c", - "build:dev": "rollup -c" - }, - "keywords": [], - "devDependencies": { - "@pandino/pandino-api": "file:../../../../packages/@pandino/pandino-api", - "@pandino/rollup-plugin-generate-manifest": "file:../../../../packages/@pandino/rollup-plugin-generate-manifest", - "@react-systemjs/component-api": "1.0.0", - "@types/react": "^18.0.26" - }, - "dependencies": { - "react": "^18.2.0" - }, - "pandino": { - "manifest": { - "Provide-Capability": "@react-esm/component-api/CustomComponent;name:=ComponentOne" - } - } -} diff --git a/examples/react-systemjs/packages/component-one/rollup.config.mjs b/examples/react-systemjs/packages/component-one/rollup.config.mjs deleted file mode 100644 index d17544ee..00000000 --- a/examples/react-systemjs/packages/component-one/rollup.config.mjs +++ /dev/null @@ -1,37 +0,0 @@ -import * as dotenv from 'dotenv'; -import clear from 'rollup-plugin-clear'; -import esbuild from 'rollup-plugin-esbuild'; -import generateManifest from '@pandino/rollup-plugin-generate-manifest'; -import nodeResolve from '@rollup/plugin-node-resolve'; -import commonjs from '@rollup/plugin-commonjs'; - -dotenv.config(); - -const ENV = process.env.NODE_ENV; - -export default [ - { - input: 'src/index.tsx', - output: { - file: 'dist/component-one.system.js', - format: 'system', - sourcemap: ENV === 'production', - }, - plugins: [ - clear({ - targets: ['dist'], - }), - nodeResolve(), - commonjs(), - esbuild({ - minify: ENV === 'production', - }), - generateManifest(), - ], - external: [ - 'react/jsx-runtime', - 'react-dom/client', - 'react', - ], - }, -]; diff --git a/examples/react-systemjs/packages/component-one/src/ComponentOne.tsx b/examples/react-systemjs/packages/component-one/src/ComponentOne.tsx deleted file mode 100644 index b3a199be..00000000 --- a/examples/react-systemjs/packages/component-one/src/ComponentOne.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { useState } from 'react'; -import type { CustomComponent } from '@react-systemjs/component-api'; - -export const ComponentOne: CustomComponent = (props) => { - const [data, setData] = useState<{ firstName: string; lastName?: string }>({ ...props }); - - return ( -
-

Component One

-

FirstName: {data.firstName}

-

LastName: {data.lastName}

-
- ); -}; diff --git a/examples/react-systemjs/packages/component-one/src/index.tsx b/examples/react-systemjs/packages/component-one/src/index.tsx deleted file mode 100644 index 533ba0b5..00000000 --- a/examples/react-systemjs/packages/component-one/src/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import type { BundleActivator, BundleContext, ServiceRegistration } from '@pandino/pandino-api'; -import { CUSTOM_COMPONENT_INTERFACE_KEY } from '@react-systemjs/component-api'; -import type { CustomComponent } from '@react-systemjs/component-api'; -import { ComponentOne } from './ComponentOne'; - -export default class AboutPageActivator implements BundleActivator { - private componentRegistration?: ServiceRegistration; - - async start(context: BundleContext) { - this.componentRegistration = context.registerService(CUSTOM_COMPONENT_INTERFACE_KEY, ComponentOne); - } - - async stop(context: BundleContext) { - this.componentRegistration?.unregister(); - } -} diff --git a/examples/react-systemjs/packages/component-one/tsconfig.json b/examples/react-systemjs/packages/component-one/tsconfig.json deleted file mode 100644 index ac57ec22..00000000 --- a/examples/react-systemjs/packages/component-one/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "lib": ["DOM", "DOM.Iterable", "ESNext"], - "allowJs": false, - "skipLibCheck": true, - "esModuleInterop": false, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "module": "ESNext", - "moduleResolution": "Node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx" - }, - "include": [ - "src" - ] -} diff --git a/examples/string-inverter/.gitignore b/examples/string-inverter/.gitignore index 05d349d6..122d899d 100644 --- a/examples/string-inverter/.gitignore +++ b/examples/string-inverter/.gitignore @@ -1,2 +1,3 @@ node_modules/ -dist/pandino.mjs +dist/@pandino + diff --git a/examples/string-inverter/cp-dependencies.sh b/examples/string-inverter/cp-dependencies.sh new file mode 100755 index 00000000..dfba8d53 --- /dev/null +++ b/examples/string-inverter/cp-dependencies.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +rm -rf dist/@pandino + +mkdir -p dist/@pandino + +cp -r ../../packages/@pandino/bundle-installer-dom/dist/@pandino ./dist +cp -r ../../packages/@pandino/loader-configuration-dom/dist/@pandino ./dist +cp -r ../../packages/@pandino/pandino/dist/@pandino ./dist diff --git a/examples/string-inverter/dist/index.html b/examples/string-inverter/dist/index.html index d8e8a043..5561e854 100644 --- a/examples/string-inverter/dist/index.html +++ b/examples/string-inverter/dist/index.html @@ -11,8 +11,8 @@

Hello!

This text should be inverted!